線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2902
推到 Plurk!
推到 Facebook!

ADOQuery ExecSQL 問題??

尚未結案
lee5100954
一般會員


發表:15
回覆:10
積分:5
註冊:2005-11-22

發送簡訊給我
#1 引用回覆 回覆 發表時間:2007-12-22 23:52:10 IP:220.132.xxx.xxx 訂閱

[code delphi]
ADOQuery5.Close;
ADOQuery5.SQL.Clear;
ADOQuery5.SQL.Text := '';
ADOQuery5.SQL.Add('Insert into ' TableName '(t1, t2, t3)');
ADOQuery5.SQL.Add(' select Top 2000 t1, t2, t3 from SearchTable ');
ADOQuery5.ExecSQL;

[/code]

請問在ADOQuery5.ExecSQL完成後,ShowMessage,但我要如何知道ADOQuery5.ExecSQL已完成呢??

謝謝
Stallion
版主


發表:52
回覆:1600
積分:1995
註冊:2004-09-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2007-12-23 08:30:24 IP:75.41.xxx.xxx 未訂閱
答案就在Online Help裡面~看看他的傳回值就知道了。
Description
Call ExecSQL to execute the SQL statement currently assigned to the SQL property. Use ExecSQL to execute queries that do not return a cursor to data (such as INSERT, UPDATE, DELETE, and CREATE TABLE).

ExecSQL returns an integer value reflecting the number of rows affected by the executed SQL statement.
Note: For SELECT statements, call Open instead of ExecSQL or set the Active property to true.
To speed performance, an application should ordinarily prepare the query by setting the Prepared property to true before calling ExecSQL for the first time.
christie
資深會員


發表:30
回覆:299
積分:475
註冊:2005-03-25

發送簡訊給我
#3 引用回覆 回覆 發表時間:2007-12-23 10:06:51 IP:218.171.xxx.xxx 未訂閱
ShowMessage( Inttostr( ADOQuery5.RowsAffected));
------
What do we live for if not to make life less difficult for each other?
lee5100954
一般會員


發表:15
回覆:10
積分:5
註冊:2005-11-22

發送簡訊給我
#4 引用回覆 回覆 發表時間:2007-12-23 21:32:18 IP:220.132.xxx.xxx 訂閱
我發現就算Access 還沒新增完成,ADOQuery5.RowsAffected 還是一樣是 2000耶??

===================引 用 christie 文 章===================
ShowMessage( Inttostr( ADOQuery5.RowsAffected));
pillar62
資深會員


發表:9
回覆:324
積分:271
註冊:2002-04-15

發送簡訊給我
#5 引用回覆 回覆 發表時間:2008-05-30 14:42:42 IP:219.87.xxx.xxx 訂閱
您好
如果您是要確認是否有真的處理成功,可以用
try
...
except
showmessage('處理失敗!')
end;
------
Pillar Wang
PenJunLi
一般會員


發表:1
回覆:2
積分:0
註冊:2005-07-02

發送簡訊給我
#6 引用回覆 回覆 發表時間:2008-06-14 00:16:31 IP:218.77.xxx.xxx 訂閱
A:介绍个DELPHI博客, 自己去找找看. http://iinsnian.cnblogs.com
如果运气好的话,也许找得到你要的答案。:-)
系統時間:2024-04-30 6:40:04
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!