Name
Connection.BeginTrans Method — CBT Method(Versions 2.0, 2.1, 2.5, 2.6)
Connection.CommitTrans Method — CCT Method(Versions 2.0, 2.1, 2.5, 2.6)
Connection.RollbackTrans Method — CRT Method(Versions 2.0, 2.1, 2.5, 2.6)
Synopsis
connection.BeginTrans
level = connection.BeginTrans( )
connection.CommitTrans
connection.RollbackTransThe BeginTrans, CommitTrans, and RollbackTrans methods are used to manage transaction processing for the current Connection object.
The BeginTrans method begins a transaction, as you might expect.
The CommitTrans method ends the current transaction, while first saving any changes and then possibly starting another transaction altogether.
The RollbackTrans method ends the current transaction, but rolls back any changes made during the current transaction. In addition, the RollbackTrans method can start another transaction, just as the CommitTrans method can.
Description
The BeginTrans, CommitTrans, and RollbackTrans methods of the Connection object perform transaction management within a particular connection. The most common example of a need for transaction management is a banking system. When you transfer money from one account to another, it is important that the two steps involved (a withdraw followed by a deposit) occur as a single transaction. By using these three transaction-management methods, we can ensure that both or none (but not either alone) of the bank steps are performed. If there is a problem with the deposit after the withdraw has completed, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access