SQL Server 2005 Try..Catch to C# Try..Catch..Finally RRS feed

  • Question

  • Hi

    Please help me. I am new to C# and SQL Server 2005, especially the exception handling side of things. Let me cut thru the chase

    How do I get SQL Server 2K5 to return the details of errors that I generated with "RAISERROR" back to my C# app? When I run the application and a system error occurs, it's fine, I can catch it in my C# app, but I can't do the same with my custom errors. I hope this makes sense. Thank you.

    Friday, June 15, 2007 12:59 PM

All replies

  • It depends on the the severity of the raiseerror.  if the severity is 10 or less the SqlConnection.InfoMessage event will be raised.  Otherwise it will manifest as a SqlException.
    Friday, June 15, 2007 1:11 PM