PRB: RollbackTrans Does Not Undo Changes To ADO Recordset

ID: Q192717


The information in this article applies to:
  • ActiveX Data Objects (ADO), versions 1.5, 2.0, 2.1 SP2
  • Microsoft Visual Basic Professional and Enterprise Editions for Windows, versions 5.0, 6.0
  • Microsoft Visual Studio versions 6.0, 97


SYMPTOMS

Calling a RollbackTrans on an ActiveX Data Objects (ADO) connection object does not undo the changes made to a client-side ADO recordset object that uses that connection.


STATUS

This behavior is by design.


MORE INFORMATION

The easiest way to revert your recordset is to persist the recordset in the desired state using the Save method that was introduced in ADO version 2.0. For example:


   rsAuthors.CursorLocation = adUseClient
   rsAuthors.Open "SELECT Au_ID, Au_LName FROM Authors", cnPubs, _
                  adOpenStatic, adLockBatchOptimistic, adCmdText
   rsAuthors.Save strPath
   cnPubs.BeginTrans
   rsAuthors!Au_LName = InputBox("Enter a new last name")
   rsAuthors.Update
   rsAuthors.UpdateBatch
   cnPubs.RollbackTrans
   rsAuthors.Open Source:=strPath, LockType:=adLockBatchOptimistic, _
                  Options:=adCmdFile
   Set rsAuthors.ActiveConnection = Nothing
   Set rsAuthors.ActiveConnection = cnPubs 
Another possible solution is to use the Resync or Requery commands on the recordset object to retrieve the most up to date information from the database.

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by David Sceppa, Microsoft Corporation

Additional query words:

Keywords : kbADO200 kbGrpVBDB kbGrpMDAC kbDSupport kbADO210sp2 kbMDAC210SP2
Version : WINDOWS:1.5,2.0,2.1 SP2,5.0,6.0,97
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: November 11, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.