Share via


StateChange Event

Note: This API is now obsolete.

Occurs when the state of the connection changes.

Namespace:  System.Data.SqlServerCe
Assembly:  System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)

Syntax

'Declaration
<ObsoleteAttribute("This property is obsolete and will be removed in a future version.")> _
Public Overrides Event StateChange As StateChangeEventHandler
'Usage
Dim instance As SqlCeConnection
Dim handler As StateChangeEventHandler

AddHandler instance.StateChange, handler
[ObsoleteAttribute("This property is obsolete and will be removed in a future version.")]
public override event StateChangeEventHandler StateChange
[ObsoleteAttribute(L"This property is obsolete and will be removed in a future version.")]
public:
virtual  event StateChangeEventHandler^ StateChange {
    void add (StateChangeEventHandler^ value);
    void remove (StateChangeEventHandler^ value);
}
[<ObsoleteAttribute("This property is obsolete and will be removed in a future version.")>]
abstract StateChange : IEvent<StateChangeEventHandler,
    StateChangeEventArgs>
[<ObsoleteAttribute("This property is obsolete and will be removed in a future version.")>]
override StateChange : IEvent<StateChangeEventHandler,
    StateChangeEventArgs>
JScript supports the use of events, but not the declaration of new ones.

Remarks

The StateChange event fires whenever the State changes from closed to opened, or from opened to closed. StateChange fires immediately after the SqlCeConnection 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

Reference

SqlCeConnection Class

SqlCeConnection Members

System.Data.SqlServerCe Namespace