ITransaction::Commit

This method commits the transaction. The Commit method may only be called by the initiator of the transaction.

HRESULT Commit( 
  BOOL fRetaining,  DWORD grfTC,  DWORD grfRM);

fRetaining
[in] Must be FALSE.

grfTC
[in] Values taken from the XACTTC enumeration, defined below.

Enumeration value Meaning

XACTTC_ASYNC

When this flag is specified, an asynchronous commit is performed. This flag may not be specified with any other flags.

XACTTC_ASYNC_PHASEONE

Same as XACTTC_ASYNC.

XACTTC_SYNC_PHASEONE

When this flag is specified, the call to Commit returns after phase one of the two-phase commit protocol. This flag may not be specified with any other flags.

XACTTC_SYNC_PHASETWO

This flag is not supported by MS Distributed Transaction Coordinator (MSDTC). When this flag is specified and MSDTC is the transaction manager, the call to Commit returns XACT_E_NOT_SUPPORTED after phase two of the two-phase commit protocol. This flag may not be specified with any other flags.

XACTTC_SYNC

This flag is not supported by MS Distributed Transaction Coordinator (MSDTC). When this flag is specified and MSDTC is the transaction manager, the call to Commit returns XACT_E_NOT_SUPPORTED after phase two of the two-phase commit protocol. This flag may not be specified with any other flags.

grfRM
[in] Must be zero.

S_OK
Success. Transaction was successfully committed.

XACT_S_ASYNC
An asynchronous commit was specified. The commit operation has begun but its outcome is not yet known. When the transaction completes, notification will be sent on the ITransactionOutcomeEvents interface if any connection point sinks are registered with the transaction object.

XACT_E_NOTRANSACTION
Unable to commit the transaction because it had already been committed or aborted. This call was ignored.

XACT_E_ALREADYINPROGRESS
A commit or abort operation was already in progress. This call was ignored.

XACT_E_NOTSUPPORTED
An invalid combination of commit flags was specified. This call was ignored.

XACT_E_CANTRETAIN
Retaining commit is not supported. This call was ignored.

XACT_E_COMMITFAILED
The transaction failed to commit for an unknown reason. The transaction was aborted.

E_FAIL
The transaction failed to commit for an unknown reason. The transaction was aborted.

XACT_E_INDOUBT
The MSDTC Proxy issued a transaction commit operation to the MSDTC TM but before the transaction manager could return the outcome of the commit to the MSDTC Proxy the connection between the MSDTC Proxy and the TM was broken. The transaction may have committed or aborted.

E_UNEXPECTED
An unexpected error has occurred. The transaction status is unknown.

XACT_E_ABORTED
The transaction was aborted before Commit was called.

XACT_E_CONNECTION_DOWN
No longer able to communicate with the transaction manager because the connection to the transaction manager failed. The transaction was aborted.

XACT_E_COMMITPREVENTED
Cannot call commit on this transaction object because the calling application did not initiate the transaction. This can happen if the transaction object was cloned with ITransactionCloner::CloneWithCommitDisabled.

For an explanation of the requirement values, see Requirements.

Platforms: Windows 2000, Windows XP, Windows Server 2003

Header: Declared in transact.h

Show:
© 2015 Microsoft