471,313 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,313 software developers and data experts.

will a client application using ado.net get an exception if the command is executing a stored procedure that does a RAISEERROR in its tsql?

will a client application using ado.net get an exception if the command is
executing a stored procedure that does a RAISEERROR in its tsql?
Feb 2 '06 #1
5 1970
Daniel,

Well, you could try it very easily (and probably have it done in the
time it took for you to get this response).

But the answer is yes. =) It should throw a SqlException.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daniel" <so*******************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
will a client application using ado.net get an exception if the command is
executing a stored procedure that does a RAISEERROR in its tsql?

Feb 2 '06 #2
Yes.

--
Dale Preston
MCAD C#
MCSE, MCDBA
"Daniel" wrote:
will a client application using ado.net get an exception if the command is
executing a stored procedure that does a RAISEERROR in its tsql?

Feb 2 '06 #3
Actually, a little more thorough answer. Yes. The client will get a
SqlException with SqlException.Number set to 50000 by default or whatever you
set your error number to in your call to RAISERROR.
--
Dale Preston
MCAD C#
MCSE, MCDBA
"Daniel" wrote:
will a client application using ado.net get an exception if the command is
executing a stored procedure that does a RAISEERROR in its tsql?

Feb 2 '06 #4
As an fyi, if you get an error with a lower severity number, you can trap it
with the infomessage event:
http://www.knowdotnet.com/articles/connections.html
"Daniel" <so*******************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
will a client application using ado.net get an exception if the command is
executing a stored procedure that does a RAISEERROR in its tsql?

Feb 2 '06 #5
Very interesting article. I wasn't familiar with the infomessage event
before. I'll have to look for an opportunity to try it out.
--
Dale Preston
MCAD C#
MCSE, MCDBA
"W.G. Ryan - MVP" wrote:
As an fyi, if you get an error with a lower severity number, you can trap it
with the infomessage event:
http://www.knowdotnet.com/articles/connections.html
"Daniel" <so*******************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
will a client application using ado.net get an exception if the command is
executing a stored procedure that does a RAISEERROR in its tsql?


Feb 3 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Stuart Ferguson | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.