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

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;