SqlException错误代码 [英] SqlException ErrorCodes

查看:76
本文介绍了SqlException错误代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,这不是问题.我的数据库有一些限制,如唯一名称(存储必须唯一的名称的列)插入或更新时,数据库将验证我们是否未覆盖某些名称,如果是,则返回可转换为SqlException的错误,代码为2627

I have a question, and it is not a problem. My database have some restrictions, as unique names (Column that stores the name of something that must be unique) When inserting or updating, the db verifies if we are not overriding some name, and if so, returns an error that is convertable to SqlException with code 2627

我的问题是...如果存在某些表格或我可以参考的东西以指示最终用户做什么?

My Question is... if exists some table or something that I can consult to indicate to the final user what to do?

在这种情况下..存在一个具有相同名称的用户....

In this case.. that exists a user with the same name....

推荐答案

我认为,您应该看看SqlExceptions

I think, you should take a look at SqlExceptions Errors property and take a look at errors number which should point you to a message in master.dbo.sysmessages table.

这篇关于SqlException错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆