Sql Server messages

  • Thread starter Thread starter Robert Bull
  • Start date Start date
R

Robert Bull

I have a stored procedure that I run from an asp.net application that
simply backs up a very small Sql Server database. If I run the stored
procedure in Query Analyzer, there is a server message returned
letting me know that the database was backed up successfully. I want
to be able to return this message in the asp.net application for
display on the screen because it contains some other useful
information. Does anyone know how to return the server message. Thanks
in advance.

-Rob
 
Hi Rob:

Add an event handler for the InfoMessage event on the SqlConnection
used to execute the stored procedure. The messages will arrive there
after the query completes.

HTH,
 
In addition to Scott's reply, messages with a severity level of 19 or more,
will throw an exception in your code.
 
Back
Top