ASP.net C# -- error handling when stored procedure is called
Posted on 2010-08-12
We use SQL Server 2005 for db backen.
We use ASP.net 3.5 and C# for the front end.
Here in our shop I am being told that if I (the DBA) use TRY CATCH error handling in the stored procedure (that is called from the webpage) that C# error handling can't "see" the error, etc. and that I should use old style error handling by checking @@Error and letting C# do most of the rest. I'm told that if I don't use TRY CATCH then C# can "see" and handle the errors thrown by the stored procedure.
This does not quite smell right to me as the DBA. So, how should error handling be done when C# calls a stored procedure? Can you point me to a resource online? I need to know how best to do the error handling in the page itself and in the stored procedure.
PS: I have googled a lot but not found an article that addresses how to handle errors in the SP when the SP is called from C#.