C# mysql函数的正确语法
我是mysql c#编程的初学者。 我遇到了以下错误: 您的SQL语法有错误;检查手册 对应于您的MySQL服务器版本,以便使用正确的语法 在第1行的“pass where username=admin1”附近 我的“更新用户密码”功能如下:C# mysql函数的正确语法,c#,mysql,asp.net,C#,Mysql,Asp.net,我是mysql c#编程的初学者。 我遇到了以下错误: 您的SQL语法有错误;检查手册 对应于您的MySQL服务器版本,以便使用正确的语法 在第1行的“pass where username=admin1”附近 我的“更新用户密码”功能如下: public Boolean update_user_password(string user_name, string new_password) { String uu = "update users set 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+"'";
你可以通过添加一些引语来修复它,但我鼓励你使用事先准备好的语句。