title: Error when attempting to execute SQL Update
body: <p><img src="https://i.stack.imgur.com/0Wtpi.png" alt="This shows an example of the row in the database that I am attempting to Update">I am trying to update a Sql DB from a Windows Forms Application in C# and I keep running into this error:</p>
  
  <blockquote>
    <p>Violation of PRIMARY KEY constraint 'PKtblStepCAB0D0D86002590DC'. Cannot insert duplicate key in object 'dbo.tblStepConfiguration_Cond'. The duplicate key value is (1, 5, 20, 3, 1).</p>
  </blockquote>
  
  <p>I understand what it is trying to say, but the thing is I am not trying to insert anything. I am trying to update it using the following.</p>
  
  <pre><code>private void SqlUpdateCommand(String DataBase, String DB_ColumnName, TextBox tb_changed, String Cond_ID, String Cond_GroupID)
  {
    int rows = 0;
    if (!String.IsNullOrEmpty(tb_ConfigID.Text) &amp;&amp; !String.IsNullOrEmpty(tb_SequenceID.Text))
    {
      System.Data.SqlClient.SqlConnection conn = null;
      string constr = ConfigurationManager.ConnectionStrings["LAP_Configuration.Properties.Settings.LAPConnectionString"].ConnectionString;
      Console.WriteLine("Connection String: {0}\n", constr);
      conn = new SqlConnection(constr);
      try
      {
        conn.Open();
  
        SqlCommand cmd = new SqlCommand("UPDATE " + DataBase + " SET "+DB_ColumnName +" = @NewName" +
                                                 " WHERE (SequenceID = @SequenceNumber AND MasterConfig = @MasterConfig AND StepNumber = @StepNumber AND Con_ID = @Con_ID AND Con_GroupID = @Cond_GroupID)", conn);
        cmd.Parameters.AddWithValue("@SequenceNumber", SeqSelected);
        cmd.Parameters.AddWithValue("@MasterConfig", ConfigSelect);
        cmd.Parameters.AddWithValue("@NewName", tb_changed.Text);
        cmd.Parameters.AddWithValue("@StepNumber", StepID);
        cmd.Parameters.AddWithValue("@Con_ID", Cond_ID);
        cmd.Parameters.AddWithValue("@Cond_GroupID", Cond_GroupID);
        rows = cmd.ExecuteNonQuery(); 
      }
      finally
      {
        if (conn != null)
        {
          conn.Close();
        }
        conn.Close();
      }
    }
  }
  </code></pre>
  
  <p>Any advice to solve the issue?
  <a href="https://i.stack.imgur.com/HrSzK.png" rel="nofollow noreferrer">enter image description here</a></p>