This one has me baffled. I have the following code for resetting a password:
resetter is just a form with two textboxes that get a password and a confirm password. When I call my ExecuteNonQuery(), I get an error stating I have a syntax error in my UPDATE statement. I have copied and pasted the manufactured string into Access (the database I'm using), and it runs fine.
Any ideas?
--Brad
Code:
using(PasswordReset resetter = new PasswordReset())
{
if(resetter.ShowDialog() == DialogResult.OK)
{
string sql = "UPDATE Users SET Password = '" + resetter.Password + "' WHERE " +
"User_ID = '" + userList.SelectedItems[userList.SelectedItems.Count-1] + "'";
OleDbCommand passwordCommand = new OleDbCommand(sql, aLib.SQLConnection);
passwordCommand.ExecuteNonQuery();
passwordCommand.Dispose();
MessageBox.Show("Password updated successfully!");
}
resetter is just a form with two textboxes that get a password and a confirm password. When I call my ExecuteNonQuery(), I get an error stating I have a syntax error in my UPDATE statement. I have copied and pasted the manufactured string into Access (the database I'm using), and it runs fine.
Any ideas?
--Brad