有以下一个过程:
procedure Tform1.Selbook(tmpstr:string);
begin
try
with adoquery1 do begin
close;
sql.Clear;
sql.Add (tmpstr);
open;
if adoquery1.RecordCount>0 then begin
first;
while not EOF do begin
listbox1.Items.Add(adoquery1.fields[1].asstring);
next;
end;
last;经试验,如不用这句,铁定出现错误提示没商量。
end;
end;
except
if adoquery1.Active then adoquery1.Close;
end;
end;
当第一次调用该过程进行查询,查出的结果是空集时,第二次再调用该过程,出现如下提示:
Either BOF or EOF is true,or the current record has been deleted, Requested operation requires a cureent record.
结果就process stoped.
已经安装了MDAC2.7,问题依旧。
问题到底出在哪里?
procedure Tform1.Selbook(tmpstr:string);
begin
try
with adoquery1 do begin
close;
sql.Clear;
sql.Add (tmpstr);
open;
if adoquery1.RecordCount>0 then begin
first;
while not EOF do begin
listbox1.Items.Add(adoquery1.fields[1].asstring);
next;
end;
last;经试验,如不用这句,铁定出现错误提示没商量。
end;
end;
except
if adoquery1.Active then adoquery1.Close;
end;
end;
当第一次调用该过程进行查询,查出的结果是空集时,第二次再调用该过程,出现如下提示:
Either BOF or EOF is true,or the current record has been deleted, Requested operation requires a cureent record.
结果就process stoped.
已经安装了MDAC2.7,问题依旧。
问题到底出在哪里?
我当时也是这么解决的,用TADODATASET,没有这样的错误。
估计是TADOQUERY从TADODATASET继承的时候有些问题。具体是什么我也没有找到。
我现在一直用TADODATASET
No.2:不要出现键值重复值。
begin
try
with adoquery1 do begin
close;
sql.Clear;
sql.Add (tmpstr);
open;
if adoquery1.RecordCount>0 then begin
while not EOF do begin
listbox1.Items.Add(adoquery1.fields[1].asstring);
next;
end;
end;
end;
except
if adoquery1.Active then adoquery1.Close;
end;
end;
去掉 first 和last
双击得到的压缩文件,自动完成了安装,应该不会有问题吧?……