简体   繁体   中英

.NET ODBC + SQL Server: How to throw error up to calling application from stored proc?

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

我发现这是ODBC的已知问题 - 要捕获错误并抛出OdbcExceptions,您必须设置为NOCOUNT。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM