asp.net.ph

SqlConnection.StateChange Event

System.Data.SqlClient Namespace   SqlConnection Class


Occurs when the state of the connection changes.

[ VB ]
Public Event StateChange As StateChangeEventHandler

[ C# ]
public event StateChangeEventHandler StateChange;

[ C++ ]
public: __event StateChangeEventHandler* StateChange;

In [ JScript ], you can handle the events defined by a class, but you cannot define your own.

Event Data

The event handler receives an argument of type StateChangeEventArgs containing data related to this event. The following StateChangeEventArgs properties provide information specific to this event.

Property Description
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.

Remarks

The StateChange event fires whenever the State changes from closed to opened, or from opened to closed. StateChange fires immediately after the SqlConnection transitions.

If an event handler throws an exception from within the StateChange event, the exception propagates to the caller of the Open or Close method.

The StateChange event is not raised unless you explicitly call Close or Dispose.

See Also

SqlConnection Members   State Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph