PRB: SQL Server ODBC Driver with ADO Spawns Second ConnectionID: Q191085
|
The first row-returning query that you run on an ADO connection to SQL Server, using the SQL Server ODBC driver causes the following query to be run on SQL Server:
select USER_NAME() select usertype,type,name from systypes where
usertype<=100
The OLE DB provider for ODBC drivers requests information from SQL Server to understand how to manage queries and results.
This behavior is by design.
If your initial row-returning query uses a client-side recordset or a server-side firehose cursor, this behavior results in a temporary connection to your SQL Server which will be closed as soon as the query has completed.
Dim cnPubs As New ADODB.Connection
Dim rsAuthors As New ADODB.Recordset
Dim strConn As String, strSQL As String
strConn = "Provider=MSDASQL;Driver={SQL Server};" & _
"Server=MyServer;Database=pubs;UID=sa;PWD=;"
strSQL = "SELECT * FROM Authors"
cnPubs.CursorLocation = adUseClient
cnPubs.Open strConn
rsAuthors.Open strSQL, cnPubs, adOpenStatic, adLockReadOnly, adCmdText
(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by David Sceppa, Microsoft Corporation.Additional query words: kbMDAC200 kbVBp600 kbADO200
Keywords : kbADO200 kbVBp600 kbMDAC200
Version : WINDOWS:1.5,2.0,5.0,6.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: May 27, 1999