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

SQL Anywhere 11.0.0 » UltraLite - .NET Programming » UltraLite .NET 2.0 API Reference » ULConnection class


StateChange event

Occurs when this connection changes state.

Visual Basic

Public Overrides Event StateChange As StateChangeEventHandler

public event override StateChangeEventHandler StateChange ;

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


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
      "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);
Event data
  • CurrentState   Gets the new state of the connection. The connection object will be in the new state already when the event is fired.

  • OriginalState   Gets the original state of the connection.

See also