title: update statement in C#,sql
body: <p>From the input I got from textbox1,textbox2 I want to check with DB and if the given user name and password combination is available, then I wanted to update the password with the input available in textbox3. Following is my code but it seems that my update statement is not working properly, please help me to correct it...</p>
  
  <pre><code>     protected void Button1_Click(object sender, EventArgs e)
      {
          MySqlConnection connection = new MySqlConnection("server=localhost; database=e-learningsystem; uid=root; password=123;port=3307;");
          connection.Open();
          try
          {
  
              MySqlCommand cmd1 = new MySqlCommand("UPDATE lecturer Set Password= '" + TextBox3.Text + "' WHERE UserName='" + TextBox1.Text + "' AND Password='" + TextBox2.Text + "'", connection);
              cmd1.ExecuteNonQuery();
              if (cmd1.ExecuteNonQuery() &gt; 0)
              {
                  Response.Write(@"&lt;script language='javascript'&gt;alert('Your Password Has Been Changed successfully!, Congratulations!')&lt;/script&gt;");
              }
              else
              {
                  Response.Write(@"&lt;script language='javascript'&gt;alert('Your Password Has Not Been Changed successfully!, Sorry!')&lt;/script&gt;");
              }
                  connection.Close();
          }
          catch (Exception ex)
          {
              Response.Write(@"&lt;script language='javascript'&gt;alert(ex.Message)&lt;/script&gt;");
          }
      }
  </code></pre>