Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - .NET Programming » UltraLite .NET 1.0 API Reference » ULConnection class

InfoMessage event Next Page

StateChange event


Occurs when this connection changes state.

Syntax

Visual Basic

Public Event StateChange As StateChangeEventHandler

C#

public event StateChangeEventHandler StateChange;

Remarks

To process state change messages, you must create a System.Data.StateChangeEventHandler delegate and attach it to this event.

Example

The following code defines a state change event handler.

' Visual Basic
Private Sub MyStateHandler( _
      obj As Object, args As StateChangeEventArgs _
    )
  System.Console.WriteLine( _
      "StateHandler: " + args.OriginalState + " to " _
      + args.CurrentState _
    )
End Sub

// C#
private void MyStateHandler(
      object obj, StateChangeEventArgs args
    )
{
  System.Console.WriteLine(
      "StateHandler: " + args.OriginalState + " to "
      + args.CurrentState
    );
}

The following code adds the MyStateHandler to the connection named conn.

' Visual Basic
AddHandler conn.StateChange, AddressOf MyStateHandler

// C#
conn.StateChange += new StateChangeEventHandler(MyStateHandler);
See also