RollbackTrans Method

Rollback the current transaction. This will undo any changes made after the BeginTrans method was called.

Syntax

Object.RollbackTrans()

Arguments - Object: Required. Always the name of ADODB Connection object.

Remarks

The following example illustrates the use of the RollbackTrans method.

Example 1:


'Create ADODB.Connection Object
Dim ConnObj   ' Create a variable.
Set ConnObj = CreateObject("ADODB.Connection")
ConnObj.Open("ConnectionString") 'Creates DB Connection by Using Connection String

ConnObj.BeginTrans()
'Execute multiple queries based on requirement
ConnObj.RollbackTrans() 'Rollback current the transaction
ConnObj.Close()
Set ConnObj = Nothing