Microsoft KB Archive/191268

= BUG: SQLOLEDB May Spawn Additional Connection For Action Query =

Article ID: 191268

Article Last Modified on 8/11/2005

-

APPLIES TO


 * Microsoft OLE DB 2.0
 * Microsoft ActiveX Data Objects 2.0
 * Microsoft ActiveX Data Objects 2.1 Service Pack 2
 * Microsoft ActiveX Data Objects 2.5
 * Microsoft ActiveX Data Objects 2.6
 * Microsoft ActiveX Data Objects 2.7
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Studio 6.0 Enterprise Edition
 * Microsoft Visual Studio 97 Service Pack 3

-



This article was previously published under Q191268



SYMPTOMS
If you have a server-side cursor open and execute an action query, the SQL Server OLE DB Provider treats an action query as if it returned data in a forward-only, read-only cursor and isolates that query on its own connection. This connection is created solely for the action query and is closed immediately after executing the query.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



MORE INFORMATION
If you do not have a server-side cursor currently opened on the ActiveX Data Objects (ADO) connection object, the SQL Server OLE DB provider does not create a second connection to the database.

Use SQL Server's SQL Trace utility to see that the following code establishes a second connection to the database to perform the action query. Modify the Data Source, User ID, and Password in the connection string to connect to your SQL Server database.

Here is the code: Dim cnPubs As New ADODB.Connection Dim rsKeyset As New ADODB.Recordset Dim strConn As String Dim strSQL As String Dim strActionQuery As String

strConn = "Provider=SQLOLEDB;Data Source=MyServer;Initial Catalog=pubs;User ID=UserName;Password=password;" strSQL = "SELECT * FROM Authors" strActionQuery = "DELETE FROM Authors WHERE 1 = 0"

cnPubs.Open strConn, "sa", "" rsKeyset.Open strSQL, cnPubs, adOpenKeyset, adLockReadOnly, adCmdText cnPubs.Execute CommandText:=strActionQuery, Options:=adExecuteNoRecords

Keywords: kbbug kbdatabase kbpending KB191268

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.