ITransactionContextEx::Commit method (comsvcs.h)

Attempts to commit the work of all COM objects participating in the current transaction. The transaction ends on return from this method.

Syntax

HRESULT Commit();

Return value

This method can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following values.

Return code Description
S_OK
The transaction was committed.
E_FAIL
The TransactionContextEx object is not running under a COM+ process, possibly indicating a corrupted registry entry for the TransactionContextEx component.
CONTEXT_E_ABORTED
The transaction was aborted.

Remarks

Calling Commit attempts to commit a transaction. However, the transaction aborts under the following conditions:

  • If a participating object returns from a method after calling SetAbort.
  • If an object calls DisableCommit and returns without calling EnableCommit or SetComplete.
  • If an error causes the Microsoft Distributed Transaction Coordinator (DTC) to abort.
When the method returns, whether the transaction commits or aborts, the transaction ends.

Examples

See the example in ITransactionContextEx::Abort.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header comsvcs.h

See also

ITransactionContextEx