Reputation: 1742
I call asynchrounously some stored procedures with BeginExecuteNonQuery and EndExecuteNonQuery (in C#). How can I catch the (defined) exceptions of these stored procedures in the C# program? Or does the try{}catch{} also works for asynchrounous calls?
Upvotes: 0
Views: 196
Reputation: 294247
Any exception with severity above 10 raised in the procedure execution that was returned to the client (ie. not swallowed by BEGIN TRY
/BEGIN CATCH
) will be raised as a SqlException in the moment you invoke EndExecuteNonQuery
.
Upvotes: 1
Reputation: 346
Not too sure if this will help but i've used this method to catch SP exceptions from C# before
http://www.java2s.com/Tutorial/CSharp/0560__ADO.Net/Catchexceptionwhencallingstoredprocedure.htm
Upvotes: 0
Reputation: 64487
Any errors raised during a stored procedure will surface in .NET as a SqlException
with an error number.
Upvotes: 0