BeginTrans Method

Starts a new transaction. This is useful for grouping multiple operations into a single transaction.

Syntax

Object.BeginTrans()

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

Remarks

The following example illustrates the use of the BeginTrans 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
'Decide CommitTrans() or RollbacksTrans() based on use case
ConnObj.CommitTrans()
ConnObj.Close()
Set ConnObj = Nothing