我是 mysql C# 编程的初学者。 我遇到了以下错误:
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
我的“update_user_password”函数如下:
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;
}
谁能告诉我如何修复这个错误?
最佳答案
您必须在用户名和密码值周围使用引号:
String uu = "update users set password'\" + new_password + "' where username='" + user_name+"'";
关于c# - mysql 函数的正确语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25031012/