Error Messages?

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.
 
W

W.G. Ryan

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top