Jeremy Stein - Brain

« »

Sql Server stored procedure throw error for .NET

When generating an error from a TSQL stored procedure to be caught by ADO.NET, you must generate an error level of 11-18. Error levels below that are ignored.

Example code:

raiserror('Bad value for x of %d', 16, 1, @x) with seterror
return @@error

I recommend error level 16 based on this article on error handling.

March 27, 2006 No Comments.

No Comments

Be the first to comment!

Leave a Reply

Your email address will not be published. Required fields are marked *

Why ask?

« »