关于ADO的困惑......谢谢(100分)

  • 主题发起人 主题发起人 wjlsnet
  • 开始时间 开始时间
--------------------------------------------------------------------------------
The information in this article applies to:

Microsoft SQL Server version 6.5
Microsoft Open Database Connectivity, versions 2.5, 3.0

--------------------------------------------------------------------------------
BUG #: 17322 (6.50)

SYMPTOMS
Multiple threads, each allocating its own HSTMT using server cursors (active statements) sharing a single connection, cause the following error on prepared execution of a SQL statement:

S1000: [Microsoft][ODBC SQL Server Driver] Connection is busy with results for another hstmt

WORKAROUND
To work around this problem, use SQLExecDirect statements instead of SQLPrepare and SQLExecute when using multiple active HSTMTs (on different threads) and server cursors.

STATUS
Microsoft has confirmed this to be a problem in SQL Server version 6.5 and Open Database Connectivity version 3.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional query words: timing multi-threaded

看看你的情况!
 
procedure ExecSqls(ss:string);
begin
with TADOQuery.Create(nil) do
begin
try
begin
Connection:=TheConnection;
Sql.Text:=ss;
ExecSql;
end;
finally
Free;
end;
end;
end;

程序的确有问题,不安全。 引用的全局变量TheConnection没有释放掉是产生这个问题的原因。
改写后好了,谢谢各位
 
多人接受答案了。
 
后退
顶部