开发者

Smart way to get unique index name from SqlException message?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜