How to catch SQLServer timeout exceptions

后端 未结 6 2054
轮回少年
轮回少年 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:42

    When a client sends ABORT, no transactions are rolled back. To avoid this behavior we have to use SET_XACT_ABORT ON https://docs.microsoft.com/en-us/sql/t-sql/statements/set-xact-abort-transact-sql?view=sql-server-ver15

提交回复
热议问题