Platform SDK: Transaction Server

ITransactionContextEx::Commit Method

[This product will work only on Windows NT 4.0 versions and earlier. For Windows 2000 and later, see COM+ (Component Services).]

Attempts to commit the current transaction.

Provided By

ITransactionContextEx Interface

HRESULT ITransactionContextEx::Commit ( );

Return Values

S_OK
The transaction was committed.

E_FAIL
The TransactionContextEx object isn't running under a MTS process. This could happen if the TransactionContextEx component's Registry entry has been corrupted.

E_UNEXPECTED
An unexpected error occurred.

CONTEXT_E_ABORTED
The transaction was aborted.

Remarks

Calling Commit doesn't guarantee that a transaction will be committed. If any MTS object that was part of the transaction has returned from a method after calling SetAbort, the transaction will be aborted. If any object that was part of the transaction has called DisableCommit and hasn't yet called EnableCommit or SetComplete, the transaction will also be aborted. Any error that causes Microsoft Distributed Transaction Coordinator to abort a transaction will also abort an MTS transaction.

When a base client calls Commit, regardless of whether the transaction commits or aborts, the transaction is completed on return from this method and all objects that participated in the transaction are automatically deactivated. If another call comes in after the TransactionContextEx object has returned from a call in which it called the Commit method, a new transaction is started.

Example

See Also

Transaction Context Objects, Base Clients, Transactions, SetComplete