title: c# webform Code won't update my Access database
body: <p>Hi guys this is code on a page titled Forgot password.aspx
  I need the user to provide their email, in order for them to reset their password.</p>
  
  <p>The problem is the program does run, but the record in the database is not updated, and the user is just redirected to the sign in page</p>
  
  <p>Am I doing something wrong?
  please help!</p>
  
  <pre><code>protected void save_Password_Click(object sender, EventArgs e)
  {
  
  
      OleDbConnection connect = new OleDbConnection();
      connect.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;
                                      Data Source=C:\Users\Student\Documents\websiteDatabase.accdb";
  
  
      OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT password FROM userInformation where emailAddress = '" + p_Email.Text + "'", connect);
  
  
      DataTable dt = new DataTable();
  
  
      adapter.Fill(dt);
  
  
  
      if ( dt.Rows.Count.ToString() == "1")
      {
  
          if(tb_newPassword.Text == tb_Confirm.Text)
          {
  
              //Opens the connection
              connect.Open();
  
              OleDbCommand cmd = connect.CreateCommand();   
  
  
              cmd.CommandText = "UPDATE userInformation SET password ='" + tb_Confirm.Text + "' WHERE emailAddress = '" + p_Email.Text  + "'";
  
  
              MessageBox.Show("Password changed successfully!");
  
  
              Response.Redirect("Sign In Page.aspx");
  
              //Closes the connection
              connect.Close();
          }
          else
          {
  
              lbl.Text = "Passwords do not match!";
  
          }
      }
      else
      {
  
          lbl.Text=" Change unsuccessful, please try again";
  
      }
  
  }
  </code></pre>