共用方式為


IDtcToXaHelperFactory::Create

 

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

Creates the XA Helper object which exposes the interface to map between OLE Transactions and the XA protocol. The Create method is typically invoked only once per ODBC connection.

Syntax

  
HRESULT Create (   CHAR * pszDSN,  CHAR * pszClientDllName,  GUID * pguidRm,  IDtcToXaHelper ** ppXaHelper);  

Parameters

pszDSN
[in] A string containing the Data Source Name (DSN).

The maximum size of this string is 3,072 characters. Prior to Windows Server 2016 and Windows 10 the maximum size is 256 characters; larger strings would cause the call to fail with E_FAIL.

pszClientDllName
[in] A string containing the name of the client DLL.

pguidRm
[out] Pointer to the GUID that DTC generates to uniquely identify this connection to the resource manager.

ppXaHelper
[out] Pointer to the pointer to the IDtcToXaHelper interface on the newly created XA Helper object.

Return Values

S_OK
Sd1

E_FAIL
The attempt to create the XA Helper object failed due to a bad installation of the DTC or the size of the string pointed to by the pszDSN parameter is too large.

E_INVALIDARG
One or more of the parameters are NULL or not valid.

E_OUTOFMEMORY
Unable to allocate resources for a XA Helper object.

E_UNEXPECTED
An unexpected error occurred.

XACT_E_CONNECTION_DOWN
Lost connection with DTC TM.

XACT_E_TMNOTAVAILABLE
Unable to establish a connection with DTC service.

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 oletx2xa.h

See Also

IDtcToXaMapper
IDtcToXaHelper
IDtcToXaHelperSinglePipe