Event Handling
The event handler receives an argument of type PsqlInfoMessageEventArgs, which contains data relevant to an event. See PsqlInfoMessageEventArgs Object for more information.
This event is defined as:
public event PsqlInfoMessageEventHandler InfoMessage;
Clients that want to process warnings and informational messages sent by the database server should create an PsqlInfoMessageEventHandler delegate to listen to this event.
You can use these events to capture failures that can occur when creating packages, stored procedures, or stored functions, which all create commands. If PSQL encounters errors when compiling a command created by a package, stored procedure, or stored function, the object is created, even though it is not valid. An event will be sent, indicating the failure.
The following code fragment defines a delegate that represents the method that handles the InfoMessage event of a PsqlConnection object:
[Serializable]
public delegate void PsqlInfoMessageEventHandler(
object sender
PsqlInfoMessageEventArgs e
);
where sender is the object that generated the event and e is an PsqlInfoMessageEventArgs object that describes the warning. For more information on Events and Delegates, refer to the .NET Framework SDK documentation.