在处理过程中如何查看执行的进度

在处理过程中如何查看执行的进度

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

问题描述

 程序TForm1.ADOQuery1FetchProgress(DataSet:TCustomADODataSet; Progress,

MaxProgress:Integer; var EventStatus:TEventStatus);

begin

Progressbar1.Visible:= true;

Progressbar1.Max:= MaxProgress;

Progressbar1.Ppsitian:=进度;

Progressbar1.Visible:= false;

end;

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



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



按钮onclick代码:

  with ADOQuery1 do 

开始

SQL.Clear;

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

打开;

end;

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



我是否代表你?

解决方案

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



检查此示例

 与ADOQuery1 do 
begin
SQL.Clear;
SQL.Add('select * from tbl1 where id ='+ Edit1.Text);
ExecuteOptions:= [eoAsyncFetch];
打开;
结束


程序TForm1.ADOQuery1FetchProgress(DataSet:TCustomADODataSet; Progress,
MaxProgress:Integer; var EventStatus:TEventStatus);
begin
ProgressBar1.Max:= MaxProgress;
ProgressBar1.Position:=进度;
Application.ProcessMessages;
结束


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;

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

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.

the button onclick codes :

with ADOQuery1 do

begin

SQL.Clear;

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

Open;

end;

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

Did i represented you?

解决方案

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

check this sample

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;

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

08-23 16:49