title: How to Identify the primary key duplication from a SQL Server 2008 error code?
body: <p>I want to know how we identify the primary key duplication error from SQL Server error code in C#.</p>
  
  <p>As a example, I have a C# form to enter data into a SQL Server database, when an error occurs while data entry, how can I identify the reason for the error from the exception?</p>