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 Wood
SoftCircuits Programming
http://www.softcircuits.com

Re: Error Messages? by W

W
Thu Jan 31 14:38:03 CST 2008

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.

--
bill.ryan | technology.evangelist | magenic.technologies
mvp - device application development
http://www.msmvps.com/WilliamRyan
http://www.magenic.com
"Jonathan Wood" <jwood@softcircuits.com> wrote in message
news:%23eyp$xqYIHA.5348@TK2MSFTNGP03.phx.gbl...
> 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 Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>



Re: Error Messages? by Jonathan

Jonathan
Thu Jan 31 19:55:04 CST 2008

Thanks, but I have no idea what InfoMessage is or how it is used.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"W.G. Ryan" <WilliamRyan@nospam.gmail.com> wrote in message
news:OElZ1kEZIHA.1204@TK2MSFTNGP03.phx.gbl...
> 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.
>
> --
> bill.ryan | technology.evangelist | magenic.technologies
> mvp - device application development
> http://www.msmvps.com/WilliamRyan
> http://www.magenic.com
> "Jonathan Wood" <jwood@softcircuits.com> wrote in message
> news:%23eyp$xqYIHA.5348@TK2MSFTNGP03.phx.gbl...
>> 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 Wood
>> SoftCircuits Programming
>> http://www.softcircuits.com
>>
>
>