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

progressbar能同步显示一费时的sql操作吗

尚未結案
luowy651
高階會員


發表:257
回覆:313
積分:114
註冊:2003-04-09

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-03-02 08:16:33 IP:218.72.xxx.xxx 未訂閱
各位大大: 小弟有一问题,我经常要用到一些比较费时的sql操作,这时我希望有一progressbar能同步显示其过程,不至于让人以为当机了,可以做到吗? Thank you very much! 發表人 - luowy651 於 2004/03/02 08:19:12
Fishman
尊榮會員


發表:120
回覆:1949
積分:2163
註冊:2006-10-28

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-03-02 08:27:03 IP:210.65.xxx.xxx 未訂閱
Hi:    參考一下天使版主大作 < href="http://delphi.ktop.com.tw/topic.php?TOPIC_ID=18171">http://delphi.ktop.com.tw/topic.php?TOPIC_ID=18171 不過要做到 ProgressBar 可能有點問題,因為不知道 Query 要花多久時間 發表人 -
------
Fishman
luowy651
高階會員


發表:257
回覆:313
積分:114
註冊:2003-04-09

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-03-02 09:10:41 IP:218.72.xxx.xxx 未訂閱
各位大大,小弟找到了以下code,据说有此功能,但我试了一下,效果也不是很好,ADOQuery1.Open;不能用ADOQuery1.Execsql;贴出来供抛砖引玉:(注意:adoquery1中的executeoptions中的eoasyncFetch要设为True) unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, DBGrids, DB, ADODB, StdCtrls, DBCtrls, ComCtrls; type TForm1 = class(TForm) ADOConnection1: TADOConnection; ADOQuery1: TADOQuery; Button1: TButton; ProgressBar1: TProgressBar; DataSource1: TDataSource; DBGrid1: TDBGrid; Label1: TLabel; Label2: TLabel; procedure Button1Click(Sender: TObject); procedure ADOQuery1FetchProgress(DataSet: TCustomADODataSet; Progress, MaxProgress: Integer; var EventStatus: TEventStatus); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin ADOQuery1.Close; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('select * from dn.dbo.table'); ADOQuery1.Open; end; procedure TForm1.ADOQuery1FetchProgress(DataSet: TCustomADODataSet; Progress, MaxProgress: Integer; var EventStatus: TEventStatus); begin ProgressBar1.Position := Progress*100 div maxProgress; label1.Caption := IntToStr(Progress); label2.Caption := IntToStr(maxProgress); Application.ProcessMessages; end; end.
系統時間:2024-06-29 16:39:52
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!