InfoMessage Event
Collapse the table of content
Expand the table of content

SqlConnection.InfoMessage Event

Occurs when SQL Server returns a warning or informational message.

[Visual Basic]
Public Event InfoMessage As SqlInfoMessageEventHandler
public event SqlInfoMessageEventHandler InfoMessage;
public: __event SqlInfoMessageEventHandler* InfoMessage;

[JScript] 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 SqlInfoMessageEventArgs containing data related to this event. The following SqlInfoMessageEventArgs properties provide information specific to this event.

Property Description
Errors Gets the collection of warnings sent from the server.
Message Gets the full text of the error sent from the database.
Source Gets the name of the object that generated the error.


Clients that want to process warnings or informational messages sent by the server should create an SqlInfoMessageEventHandler delegate to listen to this event.

The InfoMessage event fires when a message with a severity of 10 or less is returned by Sql Server. Messages with a severity between 11 and 20 raise an error and messages with a severity over 20 will cause the connection to close.

For more information and an example, see Working with Connection Events.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

SqlConnection Class | SqlConnection Members | System.Data.SqlClient Namespace

© 2015 Microsoft