Is there a SQL Server error numbers C# wrapper anyone knows of?
- by Mr Grok
I really want to do something useful when a PK violation occurs but I hate trapping error numbers... they just don't read right 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).