ITransaction::Commit

Commits the transaction.

Syntax

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

where

fRetaining
[in] Is FALSE.
grfTC
[in] Is the set of values from the enumeration XACTTC that is described below.
grfRM
[in] Is zero.

Returns

S_OK
Indicates succeeded.
XACT_S_ASYNC
Indicates an asynchronous commit was specified. The commit operation has begun, but its outcome is not yet known. The application can use the ITransactionOutcomeEvents interface to receive notice of the outcome of the transaction.
XACT_E_NOTRANSACTION
Indicates unable to commit the transaction, because it had already been committed or aborted. The call was ignored.
XACT_E_ALREADYINPROGRESS
Indicates a commit or abort operation was already in progress. The call was ignored.
XACT_E_NOTSUPPORTED
Indicates an invalid combination of commit flags was specified. The call was ignored.
XACT_E_CANTRETAIN
Indicates retaining commit is not supported. The call was ignored.
E_FAIL
Indicates the transaction failed to commit for an unknown reason. The transaction was aborted.
XACT_E_INDOUBT
Indicates the transaction status is unknown. A communication failure has occurred or a transaction manager or resource manager has failed.
E_UNEXPECTED
Indicates an unexpected error has occurred. The transaction status is unknown.
XACT_E_ABORTED
Indicates the transaction was aborted before ITransaction::Commit was called.
XACT_E_CONNECTION_DOWN
Indicates no longer able to communicate with the transaction manager, because the connection to the transaction manager failed. The transaction was aborted.

Remarks

These flags are supported for the grfTC parameter.

Flag Meaning
XACTTC_ASYNC When this flag is specified, an asynchronous commit is performed. The call to ITransaction::Commit returns as soon as the two-phase commit protocol is initiated. The application can use the ITransactionOutcomeEvents interface to determine the outcome of the transaction. This flag cannot be specified when the XACTTC_SYNCPHASEONE flag is specified.

If neither XACTTC_ASYNC nor XACTTC_SYNCPHASEONE is specified, a synchronous commit is performed.

XACTTC_SYNCPHASEONE When this flag is specified, a synchronous commit is performed. The call to ITransaction::Commit returns after phase one of the two-phase commit protocol. This flag cannot be specified when the XACTTC_ASYNC flag is specified.

If neither XACTTC_ASYNC nor XACTTC_SYNCPHASEONE is specified, a synchronous commit is performed.