title: Update data in SQL Server database
body: <p>I have registration as my database table. I want to update my information that has key in by the user into my SQL Server database. But it won't work, it don't occur any errors but the data key in wouldn't update into my database. Someone please help me if anything wrong with my code? Thanks.</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
  {
      SqlConnection con = new SqlConnection("Data Source=USER-PC;Initial Catalog=webservice_database;Integrated Security=True");
  
      SqlCommand cmd = new SqlCommand("UPDATE registration SET username = @username, password = @password, retypepassword = @retypepassword, gender = @gender, birth = @birth, address = @address, city = @city, country = @country, postcode = @postcode, email = @email, carno = @carno", con);
  
      con.Open();
  
      cmd.Parameters.AddWithValue("@username", TextBoxUsername.Text);
      cmd.Parameters.AddWithValue("@password", TextBoxPassword.Text);
      cmd.Parameters.AddWithValue("@retypepassword", TextBoxRPassword.Text);
      cmd.Parameters.AddWithValue("@gender", DropDownListGender.Text);
      cmd.Parameters.AddWithValue("@birth", DropDownListDay.Text);
      cmd.Parameters.AddWithValue("@address", TextBoxAddress.Text);
      cmd.Parameters.AddWithValue("@city", TextBoxCity.Text);
      cmd.Parameters.AddWithValue("@country", DropDownListCountry.Text);
      cmd.Parameters.AddWithValue("@postcode", TextBoxPostcode.Text);
      cmd.Parameters.AddWithValue("@email", TextBoxEmail.Text);
      cmd.Parameters.AddWithValue("@carno", TextBoxCarno.Text);
  
      cmd.ExecuteNonQuery();
  
      con.Close();
  
      if (IsPostBack)
      {
          Response.Redirect("UpdateSuccess.aspx");
      }
  </code></pre>
  
  <p>After I click confirm it somehow only update my column <code>gender</code> which from male to female, others column of data it won't update.</p>