共用方式為


ITransaction::Abort

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

This method aborts the transaction.

Syntax

  
HRESULT Abort(   BOID * pboidReason,  BOOL fRetaining,  BOOL fAsync);  

Parameters

pboidReason
[in] An optional BOID that indicates why the transaction is being aborted. This argument may be NULL indicating that no abort reason is provided.

fRetaining
[in] Must be FALSE.

fAsync
[in] When fAsync is TRUE, an asynchronous abort is performed and the caller must use ITransactionOutcomeEvents to learn the outcome of the transaction.

Return Values

S_OK
Success: the transaction was successfully aborted.

XACT_S_ASYNC
An asynchronous Abort was specified. The abort 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 abort the transaction because it had already been committed or aborted. This call was ignored.

XACT_E_ALREADYINPROGRESS
A Commit operation was already in progress. This call was ignored.

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

E_FAIL
The transaction failed to abort for an unspecified reason.

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

XACT_S_ABORTING
An Abort operation was already in progress. This call was ignored.

XACT_E_INDOUBT
This error can only be returned if the calling application did not initiate the transaction. This error implies that the MSDTC Proxy issued the abort operation on the MSDTC TM but before transaction manager could confirm that the transaction was aborted the connection between the proxy and the tm was broken. The transaction may have aborted or the transaction may still be active.

XACT_E_CONNECTION_DOWN
No longer able to communicate with the transaction manager because the connection to the transaction manager failed. The transaction state is unknown.

Remarks

The initiator of the transaction may abort the transaction as may any resource manager enlisted on the transaction.

Abort may be invoked on a transaction repeatedly. XACT_S_ABORTING HRESULT will be returned following the first invocation of Abort.

If a communication failure occurs during a call to Commit or Abort, the status of the transaction is unknown.

Requirements

For an explanation of the requirement values, see Requirements (Component Services).

Platforms: Windows Server 2016, Windows 10, Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista

Header: Declared in transact.h

See Also

ITransactionImport
ITransactionDispenser