ExecuteOptions := [eoAsyncFetch];
procedure TForm1.ADOQuery1FetchProgress(DataSet: TCustomADODataSet;
Progress, MaxProgress: Integer;
var EventStatus: TEventStatus);
begin
PBar.Max := 100;
PBar.Min := 0;
PBar.Position := Trunc(Progress / MaxProgress * 100);
Application.ProcessMessages;
end;
procedure TForm1.ADOQuery1FetchComplete(DataSet: TCustomADODataSet;
const Error: Error;
var EventStatus: TEventStatus);
begin
PBar.Position := 0;
end;
ADOQuery1.Close;
ADOQuery1.Open;
while (stFetching in ADOQuery1.RecordsetState)do
Application.ProcessMessages;
ShowMessage('OK');
我估计使用ADO的,想达到这样的效果,也只有使用异步的方式了.