为何ADOQquery打开一个空数据集后不能直接Close或Free?(100分)

A

andeuy

Unregistered / Unconfirmed
GUEST, unregistred user!
我用ADOQuery查询SQL Server,如下,我要Close或Free时,它说BOF或EOF为真,
或当前记录被删除,这个操作需要一个当前记录。
with ADOQuery1 do
begin
while (not eof) and (not FieldByName('isDept').AsBoolean) do
begin
Clb2.Items.Add(FieldByName('bmmc').AsString);
DocRight.right:='G'+FieldByName('id').AsString;
DocRight.mc:=FieldByName('bmmc').AsString;
i:=i+1;
Next;
end;
First;
Close;
end;
如果去掉First,则有上述错误。不结果集为空时,根本不能用First等移动指针,
问题不能解决,请大家帮手,谢谢!

 
还有这种问题啊。这样Ado的毛病,要打一下补丁,论坛里都出现过几百次了。下载以下两个补丁:
ftp://ftpc.borland.com/pub/delphi/devsupport/updates/delphi5/D5EntUpdate.exe
ftp://ftpc.inprise.com/pub/delphi/devsupport/updates/adoexpress/d5adoupdate2.exe
序列号在以下两个中找:
555-555-5555 9ex0-91x0
SKI-HD3-C139 92x0-92x1

 
就是就是,检索一下就有了
偶再给个注册码
111-111-1111 fex1-91x0
 
你需要安装Delphi5的AdoPatch补丁包;你可以到www.Borland.com去下载:
ftp://ftpc.borland.com/pub/delphi/devsupport/updates/delphi5/D5EntUpdate.exe
ftp://ftpc.inprise.com/pub/delphi/devsupport/updates/adoexpress/d5adoupdate2.exe
序列号在以下两个中找:
555-555-5555 9ex0-91x0
SKI-HD3-C139 92x0-92x1
 
把ADOQuery的KindType设为ReadOnly就可以了。
 
各位高手
close之前先判断 if adoquery.active then ....
行不行啊?
 
致:
[
各位高手
close之前先判断 if adoquery.active then ....
行不行啊?
]
假不假!
 
close之前先判断 if adoquery.active then ....
我是这样做的,有问题吗?请各位指教!
 
没问题,
本来就应该判断嘛
 
你判断不判断都无所谓的,先Close不会有任何问题的,解决方法还如我上面所说。
 
要安装Delphi5的AdoPatch补丁包;你可以到www.Borland.com去下载:
ftp://ftpc.borland.com/pub/delphi/devsupport/updates/delphi5/D5EntUpdate.exe
ftp://ftpc.inprise.com/pub/delphi/devsupport/updates/adoexpress/d5adoupdate2.exe
序列号在以下两个中找:
555-555-5555 9ex0-91x0
SKI-HD3-C139 92x0-92x1
 
delphi6 不知道有没有这个问题用不用下包。请指教。
 
顶部