How to see the progress of a request during processing?

I used the following code in delphi for the 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 see no effect (this code is not executing)

I want to show the progress of the query when the user clicked the button ูู SEARCH in the database from the beginning to finish the filter in the progress panel.

onclick codes button:

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

but I donโ€™t mutate in the execution line, as if not writing any code to the OnFetchProgress event.

Did I represent you?

+3
source share
1 answer

you must set the ExecuteOptions property to eoAsyncFetch before calling 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; 
+5
source

Source: https://habr.com/ru/post/1440739/


All Articles