永发信息网

delphi执行查询语句时的进度条怎么做

答案:2  悬赏:70  手机版
解决时间 2021-03-03 02:33
  • 提问者网友:末路
  • 2021-03-02 06:44
delphi执行查询语句时的进度条怎么做
最佳答案
  • 五星知识达人网友:拾荒鲤
  • 2021-03-02 08:10
procedure TForm1.FormCreate(Sender: TObject);
begin
ADOQuery1.ExecuteOptions := [eoAsyncFetch];//设为异步读取
end;
//ADOQuery的OnFetchProgress事件
procedure TForm1.ADOQuery1FetchProgress(DataSet: TCustomADODataSet; Progress, MaxProgress: Integer; var EventStatus: TEventStatus);
begin
ProgressBar1.Position := Progress;
ProgressBar1.Max := MaxProgress;
end;
//ADOQuery的OnFetchComplete事件
procedure TForm1.ADOQuery1FetchComplete(DataSet: TCustomADODataSet; const Error: Error; var EventStatus: TEventStatus);
begin
ProgressBar1.Position := ProgressBar1.Max;
ShowMessage('OK');
end;
全部回答
  • 1楼网友:人间朝暮
  • 2021-03-02 08:50
我不知道你所谓的“oracle无效对象”是神马玩意,但显示adoquery进度是有办法的。 1、将adoquery的excuteoption属性中的eoasyncfetch设为true,使其能够触发异步消息。 2、在adoquery的onfetchprogress事件里处理进度,进度会显示在窗体标题上: procedure tform1.adoquery1fetchprogress(dataset: tcustomadodataset; progress, maxprogress: integer; var eventstatus: teventstatus); begin self.caption := '完成百分比: ' + inttostr(trunc(progress / maxprogress * 100)) + '% '; application.processmessages; end;
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯