全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1080
推到 Plurk!
推到 Facebook!

ADOQuery + Memo

尚未結案
TheBloodKing
一般會員


發表:8
回覆:17
積分:10
註冊:2004-07-10

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-02-27 20:58:23 IP:61.10.xxx.xxx 未訂閱
我想用 ADOQuery 輸入 Memo 中的文字,請問如何輸入?要用Stream? 試用這好像也不行 Memo1->Lines->SaveToStream(ms); ADOQuery->Parameters->CreateParameter("Text",ftMemo,pdInput,ms->Size,Memo1->Lines); 請問有無人能幫助我
meta
中階會員


發表:3
回覆:60
積分:57
註冊:2004-06-09

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-03-01 11:28:33 IP:202.39.xxx.xxx 未訂閱
//Access+D7下OK..
procedure TForm1.btnDBClick(Sender: TObject);
var
  str:string;
  i:Integer;
begin
  for i:=0 to memo1.Lines.Count-1 do
    str:=str memo1.Lines.Strings[i];//all memo1.text
  try
    AdoQuery1.Close;
    AdoQuery1.SQL.Clear;
    AdoQuery1.SQL.Add('Insert Into table1');
    AdoQuery1.SQL.Add('values(:text)');
    AdoQuery1.Parameters.ParamByName('text').Value:=str;
    AdoQuery1.ExecSQL;
  except
    showmessage('AdoQuery Insert db error');
  end;
//參考.. http://delphi.ktop.com.tw/topic.php?topic_id=64075 http://delphi.ktop.com.tw/topic.php?topic_id=41060 //多多指教..多多指教..
TheBloodKing
一般會員


發表:8
回覆:17
積分:10
註冊:2004-07-10

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-03-04 20:22:23 IP:61.10.xxx.xxx 未訂閱
以能做到,謝謝meta回答 我以變化做c , 給大家 void __fastcall TForm1::Button1Click(TObject *Sender) { String Str; int i; for (i=0; i < Memo1->Lines->Count-1; i ) { Str= Str Memo1->Lines->Strings[i]; } try { AdoQuery1->Close(); AdoQuery1->SQL->Clear(); AdoQuery1->SQL->Add("Insert Into table1"); AdoQuery1->SQL->Add("values(:text)"); AdoQuery1->Parameters->ParamByName("text")->Value=Str; AdoQuery1->ExecSQL; } catch() Showmessage("AdoQuery Insert db error"); }
系統時間:2024-05-03 20:26:29
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!