title: Catching SQL unique key exceptions in .NET
body: <p>I was wondering if anyone had a more elegant way to check for unique key exceptions from SQL in .NET other than parsing the error message?  Right now I am calling the sproc in SQL, then using a try catch block in .NET.  In the try catch block I parse the error message and it is a Unique key error I throw an instance of a custom error to the calling class, if not I just throw the original exception the the calling class.  This seems awfully inefficient to me.</p>