Connection InfoMessage Event Handler

How can I add a InfoMessage Event Handler to the current connection I'm using?

Something like this:

myConnection.InfoMessage += new SqlInfoMessageEventHandler(myConnection_InfoMessage);

void myConnection_InfoMessage(object sender, SqlInfoMessageEventArgs e)


  • edited December 2018
    You should be able to do this within the query:
    ((SqlConnection)Connection).InfoMessage += (sender, args) => args.Message.Dump();
    ((SqlConnection)Connection).InfoMessage += (sender, args) =>
        Util.SqlOutputWriter.WriteLine (args.Message);
  • great thanks!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!