dotConnect for FreshBooks Documentation
Devart.Common Namespace / DbConnectionBase Class / TransactionStateChanged Event
Example

In This Topic
    TransactionStateChanged Event
    In This Topic
    Occurs when the state of the transaction is changed.
    Syntax
    'Declaration
     
    Public Event TransactionStateChanged As TransactionStateChangedEventHandler
    public event TransactionStateChangedEventHandler TransactionStateChanged
    Example
    This sample demonstrates how to use the TransactionStateChanged and TransactionStateChanging events.
    FreshBooksConnection connection = new FreshBooksConnection(
         "API Version=Alpha;Access Token=3d3355b2beea67f9241400fbe28f0b116e3efd2f8a85dda3c35620acdc95cd60;Refresh Token=75836f50da63fc5bf81bb24598511ae131ea422e73d9f321b4c4a44e2dd1c67f;Company Name=Devart");
         connection.TransactionStateChanged += new TransactionStateChangedEventHandler(connection_TransactionStateChanged);
         connection.TransactionStateChanging += new TransactionStateChangingEventHandler(connection_TransactionStateChanging);
         connection.Open();
    
         // ...
    FreshBooksTransaction tr = connection.BeginTransaction();
         // ...
         tr.Commit();
         // ...
    
    void connection_TransactionStateChanging(object sender, TransactionStateChangingEventArgs e) {
    
            if (e.Action == TransactionAction.Commit) {
                    // do somthing...
            }
    }
    
    void connection_TransactionStateChanged(object sender, TransactionStateChangedEventArgs e) {
         
            if (e.Action == TransactionAction.Commit) {
                    // do somthing...
            }
    }
    Dim connection As New FreshBooksConnection( _
        "API Version=Alpha;Access Token=3d3355b2beea67f9241400fbe28f0b116e3efd2f8a85dda3c35620acdc95cd60;Refresh Token=75836f50da63fc5bf81bb24598511ae131ea422e73d9f321b4c4a44e2dd1c67f;Company Name=Devart")
    AddHandler connection.TransactionStateChanged, New TransactionStateChangedEventHandler(AddressOf &_ Me.connection_TransactionStateChanged)
            AddHandler connection.TransactionStateChanging, New TransactionStateChangingEventHandler(AddressOf &_ Me.connection_TransactionStateChanging)
            connection.Open()
            '...
            Dim Transaction As FreshBooksTransaction
            Transaction = connection.BeginTransaction()
            '...
            Transaction.Commit()
            '...
    
            Private Sub connection_TransactionStateChanged(ByVal sender As Object, ByVal e As TransactionStateChangedEventArgs)
            If (e.Action = TransactionAction.Commit) Then
                    '...
            End If
    End Sub
    
    Private Sub connection_TransactionStateChanging(ByVal sender As Object, ByVal e As TransactionStateChangingEventArgs)
            If (e.Action = TransactionAction.Commit) Then
                    '...
            End If
    End Sub
    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