0

I am calling a SQL Server stored procedure from a C# .NET application using the System.Data.Odbc library. I want to be able to throw errors up to the calling application as I have been able to in the past with other drivers using raiserror or throw:

raiserror('message',18,0)

but the errors apparently aren't causing the SP to abandon execution and pass the error upwards.

Can anyone shed some light on this?

Thanks

Drew R
  • 2,988
  • 3
  • 19
  • 27

1 Answers1

2

I've discovered this is a known issue with ODBC - for errors to be caught and OdbcExceptions to be thrown, you must SET NOCOUNT ON.

Drew R
  • 2,988
  • 3
  • 19
  • 27
  • 1
    This relates to my question here: http://stackoverflow.com/questions/1483732/set-nocount-on-usage – gbn Apr 02 '13 at 13:31