Article ID: 252482 - Last Review: November 17, 2003 - Revision: 3.1 FIX: ADO Disconnected Recordset That Uses Parameterized Query Is Not Disconnected by SQL ServerThis article was previously published under Q252482 On This PageSYMPTOMS
The Microsoft ActiveX Data Objects (ADO) technology allows users to obtain a recordset from a data source, "disconnecting" that recordset from its source by setting the Recordset of the ActiveConnection property object to Nothing, and then (optionally) closing the corresponding Connection object. Microsoft highly recommends that you use this feature because it conserves scarce server resources. However, when Microsoft SQL Server is the data source, and the recordset is based on a parameterized ADO Command, SQL Server does not disconnect the user. You can observe this behavior when you use an ADO Command object as the source of your recordset, whether you use:
This behavior does not occur if you use only a Recordset object and call a parameterized stored procedure with an EXECUTE or CALL statement as the Source argument; for example, "EXEC byroyalty 100" or "{CALL byroyalty(100)}." RESOLUTION
To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.6. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
300635
(http://support.microsoft.com/kb/300635/
)
INFO: How to Obtain the Latest MDAC 2.6 Service Pack
Because SQL Server releases the database connection after the original ADO Recordset is closed, the workaround is to make a copy of the recordset with the Recordset.Clone method, close the original recordset, and work with the cloned copy.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft Data Access Components 2.6 Service Pack 1. MORE INFORMATIONSteps to Reproduce Behavior
| Article Translations
|
Back to the top
