title: Catch SQL raise error in C#
body: <p>I generate the raise error in SQL procedure:</p>
  
  <p><strong><code>RAISERROR('Already exist',-10,-10)</code></strong></p>
  
  <p>but I can not catch it using the following code in C# </p>
  
  <pre><code>catch (SqlException ex)
  {
      bResult = false;                   
      if (ex.Errors[0].Number == -10)
      {
          CommonTools.vAddToLog("bInsertNewUser", "ManageUsers", ex.Message);
          if ((savePoint != null))
              savePoint.Rollback();
      }
  } 
  </code></pre>
  
  <p>How can I catch the raised error in C# ?</p>