Reputation: 1379
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....
Upvotes: 2
Views: 32453
Reputation: 702
The meaning of the various error codes is reported here: https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/database-engine-events-and-errors?view=sql-server-ver15. Make sure you select the correct DB version on the left.
Upvotes: 0
Reputation: 3565
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.
Upvotes: 3