Is there a SQL Server error numbers C# wrapper anyone knows of? [closed]
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this questionI really want to do something useful when a PK violation occurs but I hate trapping error numbers... they just don't read right开发者_JAVA百科 without comments (they're certainly not self documenting).
I know I can find all the potential error numbers at SQL Server books online but I really want to be able to pass the error number to some helper class or look it up against a Dictionary of some sort rather than have non-descript err numbers everywhere.
Has anyone got / seen any code anywhere that encapsulates the SQL Server Error numbers in this way as I don't want to re-invent the wheel (or I'm lazy maybe).
If you use TRY/CATCH in SQL Server then when you rethrow the error it's always 50000 anyway.
Where are the error numbers coming from? LINQ? ORM? Embedded SQL? Stored procs?
精彩评论