SQL Server Raiserror not causing exception in .NET client

后端 未结 4 1317
说谎
说谎 2021-01-13 07:19

I have a stored procedure on a SQL Server 2005 database which has a statement like this:

  IF @Condition = 0
    BEGIN
        RAISERROR(\'some error message         


        
4条回答
  •  迷失自我
    2021-01-13 07:33

    According to SQL Books online severity of 16 "Indicates general errors that can be corrected by the user." - so that severity is OK.

    I only have SQL 2008 to work with, but I have tested the RAISERROR('some error message',16,1) and the error was caught in my c# app. Are you sure the error is not being handled in your "SqlHelper" class?

提交回复
热议问题