Error Messages?

  • Thread starter Thread starter Jonathan Wood
  • Start date Start date
J

Jonathan Wood

Currently, I tend to return @@ERROR in my stored procedures so that the
calling code can test for error conditions. But I'm wondering: When @@ERROR
is non-zero, is there a way for ADO.NET to detect any specific error
messages?

Thanks.
 
Jonathan:

I don't know the exact number but I think it's 13 - if you use the
InfoMessage event of the SqlConnection object, you can get back low priority
messages. One thing you can do is for instance, check the @@Error and Send
out an 'error' message that InfoMessage will pick up. I had a client that
was really big on this approach and used PRINT statments throughout their
sql if a certain tracing flag was set, they'd echo back very detailed
information about the completion of the routine and just write it out w/
print - then use InfoMessage to pick it up. I think this will work for what
you want to do.
 
Back
Top