Microsoft KB Archive/215143

{|
 * width="100%"|

-

The information in this article applies to:


 * ActiveX Data Objects (ADO), versions 2.0, 2.1, 2.1 SP1

-

SYMPTOMS
When the records in a child recordset of a hierarchical recordset are updated, the changes are committed to the database even when the ActiveConnection property of the child recordset is set to nothing. This problem does not affect the parent recordset. The parent recordset behaves correctly and does not issue the update to the database until the ActiveConnection is set to a valid connection.

NOTE: This problem does not occur if the hierarchical recordset is passed out-of-process.

RESOLUTION
Currently, the only workaround to this problem is to use the lock type of adLockBatchOptimistic and issue an UpdateBatch only when you are ready to commit the entries to the database. For local updates to the recordset you would use the Update method.

STATUS
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION
To reproduce this problem, follow the steps below. Please note that this code assumes that you are using the pubs database that ships with SQL Server. If you are using a different database, then you will need to change the SHAPE query to something that will return data from your database:


 * 1) Start a new Visual Basic 6.0 standard EXE project and add a reference to the Microsoft ActiveX Data Objects 2.0 Library.
 * 2) Place a CommandButton on the default form and place the following code behind the CommandButton event:
 * 3) Run the code (you may have to change the connection info). Note that even though the recordset is disconnected, the changes are committed to the database when the UpdateBatch is issued against the child recordset. To verify this, you can use the ISQL or Query Analyzer tool (or a similar tool depending on the database you are using) to query the underlying tables and see that the changes for the child recordset have been written to the database.

Additional query words:

Keywords : kbADO200bug kbDatabase kbGrpVBDB

Version : WINDOWS:2.0,2.1,2.1 SP1

Platform : WINDOWS

Issue type : kbprb
 * }