title: Cannot insert duplicate key row in object with unique index 'in_name'
body: <p>I get this error: Cannot insert duplicate key row in object with unique index 'in_name'
  What can be the problem?</p>
  
  <pre><code>var ing = (from x in db.tblTable where x.ing_name == ing_name select x);
  var ing1 = ing.First();
  ing1.ing_name = ing1.ing_name + " (" + FormatC(ing_brand) + ")";
  db.SaveChanges();            
  </code></pre>
  
  <p>And here is FormatC:</p>
  
  <pre><code>public static string FormatC(string str)
      {
          if (!string.IsNullOrEmpty(str))
              return str.Substring(0, 1).ToUpper() + "" + str.Substring(1).ToLower();
          else
              return "";
      }
  </code></pre>