Occurs when this connection changes state.
Visual Basic Public Overrides Event StateChange As StateChangeEventHandler
C# 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 ) { 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); |
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.
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |