DatabaseEvents DatabaseEvents DatabaseEvents Class


The DatabaseEvents object represents the settings required for Microsoft SQL Server database event notification.

public ref class DatabaseEvents
public class DatabaseEvents
Public Class DatabaseEvents


Handling SMO Events


The DatabaseEvents class is accessed through Events property and cannot be created as a stand-alone object.

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.


GetEventSelection() GetEventSelection() GetEventSelection()

Returns the currently selected event notifications.

StartEvents() StartEvents() StartEvents()

Starts receiving events.

StopEvents() StopEvents() StopEvents()

Stops receiving events.

SubscribeToEvents(DatabaseEventSet) SubscribeToEvents(DatabaseEventSet) SubscribeToEvents(DatabaseEventSet)

Specifies the database events to receive.

SubscribeToEvents(DatabaseEventSet, ServerEventHandler) SubscribeToEvents(DatabaseEventSet, ServerEventHandler) SubscribeToEvents(DatabaseEventSet, ServerEventHandler)

Specifies the database events to receive and the event handler that handles the events.

UnsubscribeAllEvents() UnsubscribeAllEvents() UnsubscribeAllEvents()

Clears all event settings, and removes all event handlers.

UnsubscribeFromEvents(DatabaseEventSet) UnsubscribeFromEvents(DatabaseEventSet) UnsubscribeFromEvents(DatabaseEventSet)

Clears the specified event settings, and removes all event handlers.


ServerEvent ServerEvent ServerEvent

Specifies the event raised when an event occurs in Database object and the user has subscribed to the events from that object instance.

Applies to