Click here to Skip to main content
15,917,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I M Using VS 2008 And Sql Server 2008.

Sql exception Does Not Print Message Using Raiserror('xxx',15,1) in sql datasource
and in c sharp code in try catch it does not catch raiserror.
Give Me The Best Solution To Print Message of Exceptions Of Sql Datasource.
Posted
Comments
CodingLover 28-Apr-11 5:14am    
are you executing a SQL or SP ?
CodingLover 28-Apr-11 5:18am    
and this is from MSDN, which I forget most of the times.

"RAISERROR can generate errors with state from 1 through 127 only. Because the Database Engine may raise errors with state 0, we recommend that you check the error state returned by ERROR_STATE before passing it as a value to the state parameter of RAISERROR."
Sandeep Mewara 28-Apr-11 5:20am    
If you provide your sample code, it would help you in getting better response.
OriginalGriff 28-Apr-11 5:29am    
Change your user name: Never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email to let you know
mhwasim 17-May-11 6:38am    
Could you pls vote my solution if it helps you....Thanks

1 solution

Please visit the following link.
http://msdn.microsoft.com/en-us/library/ms178592.aspx[^]
Search the block with the following text
-- RAISERROR with severity 11-19 will cause execution to
-- jump to the CATCH block.

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900