在处理过程中如何查看执行的进度? [英] How to see progress of query execution during handle?

查看:628
本文介绍了在处理过程中如何查看执行的进度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在delphi中使用以下代码来处理:

I used the following code in delphi for handle :

procedure TForm1.ADOQuery1FetchProgress(DataSet: TCustomADODataSet; Progress,

  MaxProgress: Integer; var EventStatus: TEventStatus);

begin

    Progressbar1.Visible:=true;

    Progressbar1.Max:=MaxProgress;

    Progressbar1.Ppsitian:=Progress;

    Progressbar1.Visible:=false;

end;

但....
我看不到任何效果(此代码不' t执行)

but.... I can't see any effect (this code doesn't execute)

我希望在用户点击数据库中的SEARCH按钮时,显示查询执行的进度,从开始到结束进度条过滤。

I want to show progress of query execution during when the user clicked a button for ٍُSEARCH in database from begining to finish filter in progressbar.

按钮onclick代码:

the button onclick codes :

with ADOQuery1 do

begin

SQL.Clear;

SQL.Add('select * from tbl1 where id = '+Edit1.Text);

Open;

end;

但是进度条中没有任何突变,就好像不写任何代码OnFetchProgress事件

but i don't any mutation in the progress bar , as though don't write any code in OnFetchProgress event.

我是否代表你?

推荐答案

设置属性 ExecuteOptions eoAsyncFetch 之前通话打开的程序

you must set property ExecuteOptions to eoAsyncFetch before to call the open procedure

检查此示例

with ADOQuery1 do
begin
 SQL.Clear;
 SQL.Add('select * from tbl1 where id = '+Edit1.Text);
 ExecuteOptions:=[eoAsyncFetch];
 Open;
end;


procedure TForm1.ADOQuery1FetchProgress(DataSet: TCustomADODataSet; Progress,
  MaxProgress: Integer; var EventStatus: TEventStatus);
begin
  ProgressBar1.Max      :=MaxProgress;
  ProgressBar1.Position :=Progress;
  Application.ProcessMessages;
end;

这篇关于在处理过程中如何查看执行的进度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆