P
puremoonstone
Unregistered / Unconfirmed
GUEST, unregistred user!
李维的《DELPHI 5.X 分布式多层应用系统篇》5-1鱼与熊掌兼得之法(PAGE 5-5)的例程中:
procedure Tform3.btnMoreClick(Sender: TObject);
var
lstart,lend:integer;
abk:tbookmark;
begin
lstart:=gettickcount;
try
if (not btrueeof) then
begin
try
abk:=clientdataset1.GetBookmark ;
if (clientdataset1.GetNextPacket<clientdataset1.PacketRecords) then
btrueeof:=true;
clientdataset1.Last ;
vownerdata:=clientdataset1.fieldbyname('orderno').value;
clientdataset1.GotoBookmark(abk);
clientdataset1.Next ;
finally
clientdataset1.FreeBookmark(abk);
end;
end;
except
on exceptiondo
;
end;
edit1.text:=inttostr(clientdataset1.recordcount);
lend:=gettickcount;
edit2.text:=floattostr((lend-lstart)/1000)+'秒';
end;
中调试时显示bTrueEof未定义,请问它是在哪个单元中定义的?
在
function TForm1.GetKeyFieldValue(Sender: TObject): OleVariant;
var
CurRecord:TBookMark;
begin
try
//保持上一次存取数据的最后一笔的信息
with sender as TClientDataSetdo
begin
CurRecord:=GetBookmark;
//存储目前记录的位置
try
last;
result:=fieldbyname('orderno').value;
gotobookmark(currecord);
//return to current record
finally
freebookmark(currecord);
end;
end;
except
on exceptiondo
;
end;
end;
中当执行到result:=fieldbyname('orderno').value;
时,系统提示“ClientDataSet1:can not perform this operation on a closed dataset”,
我想在Last前加Open,结果执行时报错:stack overflow,请问该怎么修改呢?
谢谢!
procedure Tform3.btnMoreClick(Sender: TObject);
var
lstart,lend:integer;
abk:tbookmark;
begin
lstart:=gettickcount;
try
if (not btrueeof) then
begin
try
abk:=clientdataset1.GetBookmark ;
if (clientdataset1.GetNextPacket<clientdataset1.PacketRecords) then
btrueeof:=true;
clientdataset1.Last ;
vownerdata:=clientdataset1.fieldbyname('orderno').value;
clientdataset1.GotoBookmark(abk);
clientdataset1.Next ;
finally
clientdataset1.FreeBookmark(abk);
end;
end;
except
on exceptiondo
;
end;
edit1.text:=inttostr(clientdataset1.recordcount);
lend:=gettickcount;
edit2.text:=floattostr((lend-lstart)/1000)+'秒';
end;
中调试时显示bTrueEof未定义,请问它是在哪个单元中定义的?
在
function TForm1.GetKeyFieldValue(Sender: TObject): OleVariant;
var
CurRecord:TBookMark;
begin
try
//保持上一次存取数据的最后一笔的信息
with sender as TClientDataSetdo
begin
CurRecord:=GetBookmark;
//存储目前记录的位置
try
last;
result:=fieldbyname('orderno').value;
gotobookmark(currecord);
//return to current record
finally
freebookmark(currecord);
end;
end;
except
on exceptiondo
;
end;
end;
中当执行到result:=fieldbyname('orderno').value;
时,系统提示“ClientDataSet1:can not perform this operation on a closed dataset”,
我想在Last前加Open,结果执行时报错:stack overflow,请问该怎么修改呢?
谢谢!