adoConnTransBegin
Previous Topic  Next Topic 

Synopsis:

       adoConnTransBegin(handle)

Arguments:

       handle - The connection handle.


Description:   This function starts a transaction on the connection specified by handle.     After you call the adoConnTransBegin() method, the provider will no longer instantaneously commit changes you make until you call adoConnTransCommit() or adoConnTransCancel() to end the transaction.

For providers that support nested transactions, calling the adoConnTransBegin() 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 adoConnTransCommit() or adoConnTransCancel() affects only the most recently opened transaction; you must close or roll back the current transaction before you can resolve any higher-level transactions.

Calling the adoConnTransCommit() method saves changes made within an open transaction on the connection and ends the transaction. Calling the adoConnTransCancel() 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 (see adoConnParmGet()), calling either the adoConnTransCommit() or adoConnTransCancel()  methods may automatically start a new transaction. If the Attributes property is set to adXactCommitRetaining, the provider automatically starts a new transaction after a adoConnTransCommit()  call. If the Attributes property is set to adXactAbortRetaining, the provider automatically starts a new transaction after a adoConnTransCancel() call.


Returns:   Returns 0 upon success or a negative error code.   If ADOERR_COMERR is returned, then the underlying ADO error can be obtained by calling adoLastError()