dbenlisttrans

Enlists the current SQL Server connection in an existing MS DTC transaction.

Syntax

RETCODE dbenlisttrans (
PDBPROCESS
dbproc,
LPVOID
pTransaction );

where

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 ITransactionDispenser::BeginTransaction 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 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. For information about MS DTC, see the Guide to Microsoft Distributed Transaction Coordinator.
  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 above.

See Also

dbenlistxatrans