How to catch SQLServer timeout exceptions

后端 未结 6 2047
轮回少年
轮回少年 2020-11-27 11:32

I need to specifically catch SQL server timeout exceptions so that they can be handled differently. I know I could catch the SqlException and then check if the message stri

6条回答
  •  再見小時候
    2020-11-27 11:52

    Whats the value for the SqlException.ErrorCode property? Can you work with that?

    When having timeouts, it may be worth checking the code for -2146232060.

    I would set this up as a static const in your data code.

提交回复
热议问题