第一次可以执行,第二次就出错了呢?adoquery关闭会出错?(20分)

  • 主题发起人 主题发起人 noall
  • 开始时间 开始时间
N

noall

Unregistered / Unconfirmed
GUEST, unregistred user!
with Queryans do begin //queryans是TAdoquery
Queryans.Active :=False;//第二次时在这里出错
SQL.Clear;
SQL.Add('Select * from answer where parent='+IntToStr(OneNum));
Prepared:=True;
Open;
Memo.Clear ;
while not eof do begin
memo.Lines.Add(FieldByname('content').asString);
next;
end;
end;
 
试试这样
with Queryans do begin //queryans是TAdoquery
close;
SQL.Clear;
SQL.Add('Select * from answer where parent='+IntToStr(OneNum));
Prepared:=True;
Open;
Memo.Clear ;
while not eof do begin
memo.Lines.Add(FieldByname('content').asString);
next;
end;
end;
 
一样,也是错误的。
错误信息是:
Either Bof or Eof is True,or the current record has been deleted,
Requested operation requires a current record
 
此乃Ado的Bug,建議升級Ado或使用Delphi6.0.
Ado的升級包可去此下載:
http://www.csdn.net/cnshare/soft/4/4541.shtm
 
试试这样
with Queryans do begin //queryans是TAdoquery
close;
SQL.Clear;
SQL.Add('Select * from answer where parent='+IntToStr(OneNum));
Prepare;
Open;
Memo.Clear ;
while not eof do begin
memo.Lines.Add(FieldByname('content').asString);
next;
end;
end;
 
我用的是DELPHI6,按照这段代码试了很多事件,都没有出现错误,我想大概是你版本问题吧,升级后再试一试?
 
zxb200:我下载了并升级了,可再打开delphi时却出现不能加载Ado控件包的现象。。

用active:=False 或用close都会出错。
 
原来要再升级一下,http://www.csdn.net/cnshare/soft/4/4541.shtm这里下载升级一,再
到波兰里下载d5adoupdate2后就可以了。谢谢给分
 
接受答案了.
 
后退
顶部