9 The SQL Server Data Provider : Event Handling

Event Handling
The SQLServerInfoMessageEventHandler event is a delegate that represents the method that handles the InfoMessage event of a SQLServerConnection object. It is defined as follows:
[Serializable]
public delegate void SQLServerInfoMessageEventHandler(
   object sender,
   SQLServerInfoMessageEventArgs e
);
where sender is the object that generated the event and e is a SQLServerInfoMessageEventArgs object that describes the warning.
To retrieve warning information from the database server, the application should add an instance of the delegate to the event (InfoMessage property of the SQLServerConnection object). The event handler is called every time the event happens until the delegate is removed. For more information on events and delegates, refer to the Microsoft Framework SDK documentation.