如何解决‘Connection is busy with results for another command’?(50分)

T

touip

Unregistered / Unconfirmed
GUEST, unregistred user!
环境: delphi6 + ADO + sqlServer

出现‘Connection is busy with results for another command’,
请问有什么方法可解决?
我记得ADOConnection可支持多个数据库连接,为什么有并发访问时会出错?
 
是不是你上一个命令没有关闭啊
为安全起见,建议如下写法:

AdoQuery1.Close;
AdoQuery1.Sql.Clear;
AdoQuery1.Sql.Add(........);
AdoQuery1.open或ExecSQL

 
用的是adocommand
 
那你直接用adocommand.cancel或看看adocommand的states属性,
 
最好还是不要让并发的ADOQuery共享Connection
 
多个线程,多个 ( ADOCOMMAND+ADOCONNECTION )?
有没什么好办法?
 
其实完全可以每个ADOQuery都自己build连接字符串。不通过ADOConnection的。
 
如果用
while true do
begin
ADOComand1.CommandText := 'insert into a values ('xx','xxx');
ADOComand1.execute;
end;
最快可以达到多少?
 
顶部