views:

28

answers:

3

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?

A: 

Any errors raised during a stored procedure will surface in .NET as a SqlException with an error number.

Adam
A: 

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
Wes Price
+1  A: 

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.

Remus Rusanu