Reputation: 11
I'm a beginner in mysql c# programming. I ran into the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"pass where username=admin1' at line 1
my "update_user_password" function is the following:
public Boolean update_user_password(string user_name, string new_password)
{
String uu = "update users set password=\"" + new_password + " where username=" + user_name;
Boolean error = !execute_cmd_db(uu.ToString());
return !error;
}
Can anyone please tell me how I can fix this error?
Upvotes: 0
Views: 53
Reputation: 69460
You have to use quotes around the values of username and password:
String uu = "update users set password'\" + new_password + "' where username='" + user_name+"'";
Upvotes: 1