please dont rip this site

BeginTrans, CommitTrans, RollbackTrans Methods

The transaction methods manage transaction processing within a Connection object as follows

· BeginTrans begins a new transaction.

· CommitTrans saves any changes and ends the current transaction. It may also start a new transaction.

· RollbackTrans cancels any changes made during the current transaction and ends the transaction. It may also start a new transaction.


[level = ] connection.BeginTrans
connection.{CommitTrans | RollbackTrans}

The connection placeholder is an object variable representing an open Connection object.

The level placeholder represents a Long variable to which the BeginTrans method can return a value indicating the nesting level of the transaction. The CommitTrans and RollbackTrans methods do not return any value.


Use these methods with a Connection object when you want to save or cancel a series of changes made to the source data as a single unit. For example, to transfer money between accounts, you subtract an amount from one and add the same amount to the other. If either update fails, the accounts no longer balance. Making these changes within an open transaction ensures either all or none of the changes goes through.

Once you call the BeginTrans method, the provider will no longer instantaneously commit any changes you make until you call CommitTrans or RollbackTrans to end the transaction.

For providers that support nested transactions, calling the BeginTrans method within an open transaction starts a new, nested transaction. The return value indicates the level of nesting: a return value of "1" indicates you have opened a top-level transaction (that is, the transaction is not nested within another transaction), "2" indicates that you have opened a second-level transaction (a transaction nested within a top-level transaction), and so forth. Calling CommitTrans or RollbackTrans affects only the most recently opened transaction; you must close or rollback the current transaction before you can resolve any higher level transactions.

Calling the CommitTrans method saves changes made within an open transaction on the connection and ends the transaction. Calling the RollbackTrans method reverses any changes made within an open transaction and ends the transaction. Calling either method when there is no open transaction generates an error.

Depending on the Connection object's Attributes property, calling either the CommitTrans or RollbackTrans methods may automatically start a new transaction. If the Attributes property is set to adXactCommitRetaining, ADO automatically starts a new transaction after a CommitTrans call. If the Attributes property is set to adXactAbortRetaining, ADO automatically starts a new transaction after a RollbackTrans call.

Applies To


See Also


file: /Techref/language/asp/comp/dameth01_3.htm, 3KB, , updated: 1996/11/21 19:01, local time: 2022/8/9 06:24,

 ©2022 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> BeginTrans, CommitTrans, RollbackTrans Methods (ADO)</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

We sell a few items to support this site

Welcome to!