dotConnect for Zoho CRM Documentation
Devart.Common Namespace / DbConnectionBase Class / EnlistTransaction Method
A reference to an existing System.Transactions.Transaction in which to enlist.
Example

In This Topic
    EnlistTransaction Method
    In This Topic
    Enlists in the specified transaction.
    Syntax
    'Declaration
     
    Public Overrides Sub EnlistTransaction( _
       ByVal transaction As Transaction _
    ) 
    public override void EnlistTransaction( 
       Transaction transaction
    )

    Parameters

    transaction
    A reference to an existing System.Transactions.Transaction in which to enlist.
    Remarks

    Once a connection is explicitly enlisted in a distributed transaction, it cannot be unenlisted or enlisted in another transaction until the first transaction finishes.

    Example
    These samples demonstrate usage of Devart.Data.Zoho.ZohoConnection.EnlistTransaction.
    ZohoCommand1.Connection=ZohoConnection1;
    using (TransactionScope transScope = new TransactionScope()) {
     ZohoConnection1.Open();
     ZohoCommand1.ExecuteNonQuery();
     transScope.Complete();
    }
    ZohoConnection1.Close();
    
    - or -
    
    ZohoCommand1.Connection=ZohoConnection1;
    ZohoConnection1.Open();
    using (TransactionScope transScope = new TransactionScope()) {
     ZohoConnection1.EnlistTransaction(Transaction.Current);
     ZohoCommand1.ExecuteNonQuery();
     transScope.Complete();
    }
    ZohoConnection1.Close();
    
    - or -
    
    CommittableTransaction cmtTx = new CommittableTransaction();
    ZohoConnection1.Open();
    ZohoConnection1.EnlistTransaction(cmtTx);
    ZohoCommand1.ExecuteNonQuery();
    ZohoConnection1.Close();
    Me.ZohoCommand1.Connection = Me.ZohoConnection1
    Using transScope = New Transactions.TransactionScope
      Me.ZohoConnection1.Open()
      Me.ZohoCommand1.ExecuteNonQuery()
      transScope.Complete()
    End Using
    Me.ZohoConnection1.Close()
    
    - or -
    
    Me.ZohoCommand1.Connection = Me.ZohoConnection1
    Me.ZohoConnection1.Open()
    Using transScope = New Transactions.TransactionScope
      Me.ZohoConnection1.EnlistTransaction(Transactions.Transaction.Current)
      Me.ZohoCommand1.ExecuteNonQuery()
      transScope.Complete()
    End Using
    Me.ZohoConnection1.Close()
    
    - or -
    
    Dim cmtTx As New Transactions.CommittableTransaction
    Me.ZohoConnection1.Open()
    Me.ZohoConnection1.EnlistTransaction(cmtTx)
    Me.ZohoCommand1.ExecuteNonQuery()
    Me.ZohoConnection1.Close()
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also