BUG: Disconnected Hierarchical Recordset Does Not Disconnect from Database Server
This article was previously published under Q288409 On This PageSYMPTOMS If you open a hierarchical ActiveX Data Objects (ADO)
recordset by using the Microsoft Data Shaping Service for OLE DB (MSDataShape)
provider, set the Recordset's ActiveConnection = Nothing to disconnect the recordset, and then close the ADO Connection
object, ADO reports that the Connection.State = 0 (adStateClosed). However, if you then check open connections on the database server (for example, by checking the SYSPROCESSES table on SQL Server when you use SQLOLEDB, or by checking the V$SESSION table on Oracle when you use MSDAORA), you see that the connection to the database server remains open. CAUSE The ADO Client Cursor Engine (CCE) is not calling the
appropriate method on the MSDataShape provider to indicate that the recordset
is being disconnected and to release the reference held to the OLE DB Command
object. RESOLUTION As long as a shaped ADO Recordset object remains in the
client application (that is, as long as it has not explicitly been destroyed or
gone out of scope), the Recordset's Connection remains open on the database
server. As a developer, you must understand and address the possible
ramifications of this behavior. As a workaround, you can persist the Recordset to another format (to XML, to ADTG format, or to a Stream), and then close the original Recordset to release the connection and reload the persisted data into a new, disconnected Recordset. STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
MORE INFORMATIONSteps to Reproduce BehaviorThe following steps use Microsoft Visual Basic and the Microsoft SQL Server Northwind sample database:
REFERENCESFor additional information, click the article number below to
view the article in the Microsoft Knowledge Base: 252482 (http://support.microsoft.com/kb/252482/EN-US/) BUG: ADO Disconnected Recordset That Uses Parameterized Query Is Not Disconnected by SQL Server
APPLIES TO
| Article Translations
|

Back to the top
