开发者

Smart way to get unique index name from SqlException message?

开发者 https://www.devze.com 2023-03-26 22:08 出处:网络
Is there there any smart/best way to get the unique index name from SqlException message? like 开发者_Python百科the following:

Is there there any smart/best way to get the unique index name from SqlException message? like 开发者_Python百科the following:

Cannot insert duplicate key row in object 'partners.Partner' with unique index 'IX_Partner_SerialId'. The statement has been terminated.

I need to get IX_Partner_SerialId without having to manipulate the exception message string? something like a variable in the exception object?


Unfortunately not.

You will have to parse message text. You can find the message texts and error numbers by querying

SELECT * FROM SYSMESSAGES

0

精彩评论

暂无评论...
验证码 换一张
取 消