开发者

list of all kind sql exceptions

开发者 https://www.devze.com 2023-01-17 03:21 出处:网络
How can i gets the name of all SQL exceptions? For handling them in my project?开发者_如何学运维 Thanks.I think you mean error number.

How can i gets the name of all SQL exceptions? For handling them in my project?开发者_如何学运维 Thanks.


I think you mean error number. You can get a list of numbers and their descriptions there. However it may not be complete, because different databases may use some additional codes as well.

So in your case you may want to catch SqlException, get its error collection (SqlErrorCollection) and check for Number property in every SqlError of this collection.

UPD: Since you want to translate the error, I think it is better to look for severities (SqlException.Class property) and if you are using MS SQL you can look up that severity in SYSMESSAGES database, it looks that there may be translation already for your language.


There is only one exception type in the System.Data.SqlClient namespace, and that's SqlException.

0

精彩评论

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