Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

OdbcConnection::EnlistDistributedTransaction Method (ITransaction^)

 

Enlists in the specified transaction as a distributed transaction.

Namespace:   System.Data.Odbc
Assembly:  System.Data (in System.Data.dll)

public:
void EnlistDistributedTransaction(
	ITransaction^ transaction
)

Parameters

transaction
Type: System.EnterpriseServices::ITransaction^

A reference to an existing ITransaction in which to enlist.

New in ADO.NET 2.0 is support for using the M:System.Data.Common.DbConnection.EnlistTransaction(System.Transactions.ITransaction) method to enlist in a distributed transaction. Because it enlists a connection in a Transaction instance, EnlistTransaction takes advantage of functionality available in the System.Transactions namespace for managing distributed transactions, making it preferable to EnlistDistributedTransaction for this purpose. For more information, see Distributed Transactions.

You can continue to enlist in an existing distributed transaction using the M:System.Data.OdbcClient.OdbcConnection.EnlistDistributedTransaction method if auto-enlistment is disabled. Enlisting in an existing distributed transaction makes sure that, if the transaction is committed or rolled back, modifications made by the code at the data source are also committed or rolled back. For more information about distributed transactions, see Distributed Transactions.

EnlistDistributedTransaction returns an exception if the T:System.Data.OdbcClient.OdbcConnection has already started a transaction using M:System.Data.OdbcClient.OdbcConnection.BeginTransaction. However, if the transaction is a local transaction started at the data source (for example, by explicitly executing the BEGIN TRANSACTION statement using an T:System.Data.OdbcClient.OdbcCommand object), EnlistDistributedTransaction rolls back the local transaction and enlists in the existing distributed transaction as requested. You will not receive notice that the local transaction was rolled back, and are responsible for managing any local transactions not started using M:System.Data.OdbcClient.OdbcConnection.BeginTransaction.

.NET Framework
Available since 1.1
Return to top
Show:
© 2017 Microsoft