L
luaijun
Unregistered / Unconfirmed
GUEST, unregistred user!
这是李维第三本书中的一个例子,非常奇怪的,单步执行没问题,但一运行,点击其中一个button
,没得到结果前,会出错,说"Canvas don't allow drawing",我觉得问题出在
procedure TForm1.ADODataSet1FetchProgress 上, 因showmessage 框没有出现
可不知怎么办,请教各们,非常感谢.这是是全部程序
procedure TForm1.FormActivate(Sender: TObject);
var sRecNo:string;
begin
ProgressBar1.Max:=ADOCommand1.Execute.Fields.Item[0].Value;
sRecNo:=IntToStr(ProgressBar1.Max);
Self.Caption:='共有'+sRecNo+'数据';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
try
ADODataSet1.Active:=false;
ADODataSet1.ExecuteOptions:=[eoAsyncFetchNonBlocking];
finally
lStart:=GetTickCount;
ADODataSet1.Active:=true;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
try
ADODataSet1.Active:=false;
ADODataSet1.ExecuteOptions:=[eoAsyncFetch];
finally
lStart:=GetTickCount;
ADODataSet1.Active:=true;
end;
end;
procedure TForm1.ADODataSet1FetchProgress(DataSet: TCustomADODataSet;
Progress, MaxProgress: Integer; var EventStatus: TEventStatus);
begin
ProgressBar1.Position:=Progress;
end;
procedure TForm1.ADODataSet1FetchComplete(DataSet: TCustomADODataSet;
const Error: Error; var EventStatus: TEventStatus);
begin
lEnd:=GetTickCount;
ShowMessage('总共化了'+FloatToStr((lEnd-lStart)/1000.0)+'秒');
end;
end.
,没得到结果前,会出错,说"Canvas don't allow drawing",我觉得问题出在
procedure TForm1.ADODataSet1FetchProgress 上, 因showmessage 框没有出现
可不知怎么办,请教各们,非常感谢.这是是全部程序
procedure TForm1.FormActivate(Sender: TObject);
var sRecNo:string;
begin
ProgressBar1.Max:=ADOCommand1.Execute.Fields.Item[0].Value;
sRecNo:=IntToStr(ProgressBar1.Max);
Self.Caption:='共有'+sRecNo+'数据';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
try
ADODataSet1.Active:=false;
ADODataSet1.ExecuteOptions:=[eoAsyncFetchNonBlocking];
finally
lStart:=GetTickCount;
ADODataSet1.Active:=true;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
try
ADODataSet1.Active:=false;
ADODataSet1.ExecuteOptions:=[eoAsyncFetch];
finally
lStart:=GetTickCount;
ADODataSet1.Active:=true;
end;
end;
procedure TForm1.ADODataSet1FetchProgress(DataSet: TCustomADODataSet;
Progress, MaxProgress: Integer; var EventStatus: TEventStatus);
begin
ProgressBar1.Position:=Progress;
end;
procedure TForm1.ADODataSet1FetchComplete(DataSet: TCustomADODataSet;
const Error: Error; var EventStatus: TEventStatus);
begin
lEnd:=GetTickCount;
ShowMessage('总共化了'+FloatToStr((lEnd-lStart)/1000.0)+'秒');
end;
end.