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

How to use ADOQuery?

尚未結案
Vashee
初階會員


發表:38
回覆:87
積分:25
註冊:2003-03-31

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-04-03 06:43:19 IP:217.36.xxx.xxx 未訂閱
I am using Delphi with Access DBase. Can I set my own query in delphi or I need to set up the query in Access, then use ADOQuery to link it. Which way is better? Does query updates the database automatically? or I have to set a situation, like a algorithm to trigger the query? Thanks alot
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-04-03 07:48:18 IP:202.39.xxx.xxx 未訂閱
如果您會用 TDatabase 與 TQuery 元件的話 那您可以把 TADOConnection 看成 TDatabse TADOQuery 看成 TQuery 用法是類似的, 雖然有點不一樣. 這裏有一篇, 參考看看: http://delphi.about.com/library/weekly/aa050101a.htm --- 每個人都是一本書
Vashee
初階會員


發表:38
回覆:87
積分:25
註冊:2003-03-31

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-04-03 08:58:19 IP:217.36.xxx.xxx 未訂閱
Then what's the different between ADODataset and ADOQuery? both need SQL syntex to work
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-04-03 09:38:38 IP:202.39.xxx.xxx 未訂閱
引言: Then what's the different between ADODataset and ADOQuery? both need SQL syntex to work
小弟都是用 TADOTable 與 TADOQuery 所以不知講得對不對? 看 help 中說的, 如果要回傳 result set 的 即 SQL 為 Select 的, 則用 TADODataset 如果沒回傳 result set的, 即 SQL 為 Insert/Update/Delete 類的 使用 TADOCommand 如果是 TADOQuery 的話, 則兩類都可使用 如果 SQL 是 Select 的話, 用 TADOQuery.Open; 如果 SQL 是 Insert/Update/Delete 的話, 用 TADOQuery.ExecSQL; --- 每個人都是一本書
Vashee
初階會員


發表:38
回覆:87
積分:25
註冊:2003-03-31

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-04-03 17:55:57 IP:195.195.xxx.xxx 未訂閱
What is mean by 要回傳 result set ? can u give me an example?
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-04-03 18:11:53 IP:202.39.xxx.xxx 未訂閱
引言: What is mean by 要回傳 result set ? can u give me an example?
1.有回傳的
begin
  ADOQuery1.Connection := ADOConnection1;
  ADOQuery1.Close;
  ADOQuery1.SQL.Text ;= 'Select * From TableA';
  ADOQuery1.Open;
end;
2.沒回傳的
begin
  ADOQuery1.Connection := ADOConnection1;
  ADOQuery1.Close;
  ADOQuery1.SQL.Text ;= 'Delete From TableA';
  ADOQuery1.ExecSQL;
end;
--- 每個人都是一本書
Vashee
初階會員


發表:38
回覆:87
積分:25
註冊:2003-03-31

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-04-03 18:16:02 IP:195.195.xxx.xxx 未訂閱
may be i am not very clever. I still don't understand
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-04-03 18:27:37 IP:202.39.xxx.xxx 未訂閱
引言: may be i am not very clever. I still don't understand
這麼說好了, 只要是 SQL 是 Select 開頭的 它就會回傳所 Select 的資料 這結果可以資料感知元件(像是 TDBGrid, TDBEdit等)來顯示 若 SQL 是 Insert/Update/Delete 開頭的話 它就不會回傳資料 咦?好像還是講得跟之前一樣! --- 每個人都是一本書
Vashee
初階會員


發表:38
回覆:87
積分:25
註冊:2003-03-31

發送簡訊給我
#9 引用回覆 回覆 發表時間:2003-04-03 18:37:28 IP:195.195.xxx.xxx 未訂閱
yes, i understand now. thnx do u know anywhere I can find all the 'coding' for SQL? any site, or online tutorial that teach u all the basic coding. like insert, delete all.. etc?
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#10 引用回覆 回覆 發表時間:2003-04-04 11:11:05 IP:202.39.xxx.xxx 未訂閱
引言: yes, i understand now. thnx do u know anywhere I can find all the 'coding' for SQL? any site, or online tutorial that teach u all the basic coding. like insert, delete all.. etc?
這裏一個: http://www.w3schools.com/sql/default.asp --- 每個人都是一本書
系統時間:2024-06-26 11:53:39
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!