```
private void btn_Update_Click(object sender, EventArgs e)
{
    con.Open();
    SqlCommand cmd = con.CreateCommand();
    cmd.CommandType = CommandType.Text;
    cmd.CommandText = "update MyWeight set Weight='" + txt_Weight.Text + "'where Name='" + txt_Name.Text + "'";
    string a = (string)cmd.ExecuteScalar();
    con.Close();

    if (a != null)
    {
        cmd.ExecuteNonQuery();
        con.Close();

        display_data();
        MessageBox.Show("Weight updated successfuly!!!");
    }
    else
    {
        con.Close();

        display_data();
        MessageBox.Show("Not updated!!!");
    }
}

```

I tried to update the weight into the database, but the database keeps saying that it is not updated.