Is there a SQL Server error numbers C# wrapper anyone knows of?

Posted by Mr Grok on Stack Overflow See other posts from Stack Overflow or by Mr Grok
Published on 2010-05-24T08:30:00Z Indexed on 2010/05/24 8:41 UTC
Read the original article Hit count: 277

Filed under:
|
|

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).

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql-server