dbenlisttrans

Enlists the current Microsoft® SQL Server™ connection in an existing Microsoft Distributed Transaction Coordinator (MS DTC)  transaction.

Syntax

RETCODE dbenlisttrans (
PDBPROCESS
dbproc,
LPVOID pTransaction);

Arguments
dbproc
Is the DBPROCESS structure that is the handle for a particular workstation/SQL Server process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.
pTransaction
Is the MS DTC transaction OLE object that specifies the transaction to export to SQL Server. The client calls the MS DTC OLE object ITransactionDispenser::Begin Transaction method to create the MS DTC transaction object.
Returns

SUCCEED or FAIL.

Remarks

The client application must call dbenlisttrans before performing the first update on a server running SQL Server that is enlisted in an MS DTC transaction.

To update two or more (n) SQL Servers using MS DTC

  1. Connect to the MS DTC by using the MS DTC OLE DtcSelectTransactionManager method to obtain a transaction manager object.
  2. Call dbopen n times to connect to each SQL Server.
  3. Call the MS DTC OLE ITransactionDispenser::BeginTransaction method to begin the MS DTC transaction and to obtain a transaction object.
  4. Call dbenlisttrans n times to send the MS DTC transaction to each SQL Server.
  5. Call dbsqlexec n times to perform one or more MS DTC transaction updates on each SQL Server.
  6. Call the MS DTC OLE ITransaction::Commit method to commit the MS DTC transaction. The transaction object is no longer valid after the transaction commits.
  7. Call the MS DTC OLE ITransaction::Return method to release the reference to the transaction object.
  8. Either

    Or


Note You can also call dbenlisttrans and dbsqlexec in turn for each SQL Server instead of calling them as suggested in steps 4 and 5 earlier.


See Also
dbenlistxatrans  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.