Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

SqlConnection.EnlistDistributedTransaction Method

Enlists in the specified transaction as a distributed transaction.

Namespace: System.Data.SqlClient
Assembly: System.Data (in system.data.dll)

public void EnlistDistributedTransaction (
	ITransaction transaction
)
public void EnlistDistributedTransaction (
	ITransaction transaction
)
public function EnlistDistributedTransaction (
	transaction : ITransaction
)

Parameters

transaction

A reference to an existing ITransaction in which to enlist.

New in ADO.NET 2.0 is support for using the EnlistTransaction 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 Performing a Distributed Transaction.

You can continue to enlist in an existing distributed transaction using the 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.

EnlistDistributedTransaction returns an exception if the SqlConnection has already started a transaction using 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 SqlCommand object), EnlistDistributedTransaction rolls back the local transaction and enlists in the existing distributed transaction as requested. You do not receive notice that the local transaction was rolled back, and are responsible for managing any local transactions not started using BeginTransaction.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.