ITransactionOptions::SetOptions

Changes transaction attributes in a transaction options object. After changing the options, you can pass the transaction options object to the ITransactionDispenser::BeginTransaction method. The attributes of the transaction options object are inherited by the newly initiated transaction.

Transaction attributes are specified by using the XACTOPT structure that is defined below.

ITransactionOptions::SetOptions must not be called on a transaction options object that is currently being used by the ITransactionDispenser::BeginTransaction method.

Syntax

HRESULT SetOptions ( XACTOPT* pOptions )

where

pOptions
[in] Is the pointer to the XACTOPT structure that is allocated by the caller. This structure contains attribute information for a transaction option object.

The XACTOPT structure is defined as follows:

typedef struct XACTOPT
{
ULONG ulTimeout;
unsigned char szDescription[ MAX_TRAN_DESC ];
}   XACTOPT;

The XACTOPT structure members are described below.
Member Description
ulTimeOut Is the time, in milliseconds, before the transaction is automatically aborted. Zero indicates an infinite time out.

The time out limits the duration of the transaction and therefore bounds the amount of time locks are held on database records and system resources. If the time-out period expires before the transaction commits, MS DTC automatically aborts the transaction.

szDescription Is a textual description for a transaction. The transaction description is displayed by the MS DTC management interface in the MS DTC Transactions window. The transaction description is for the MS DTC administrator only; it is not processed or interpreted by MS DTC itself.

The transaction description cannot be longer than MAX_TRAN_DESC bytes in length.


Returns

S_OK
Indicates succeeded.
E_OUTOFMEMORY
Indicates unable to allocate memory.
E_INVALIDARG
Indicates the value of pOptions is NULL.