数据更新不成功,感觉在是sql语句问题,求帮助

问题遇到的现象和发生背景

在JDBC的使用里,我的数据需要更新,确不成功

问题相关代码,请勿粘贴截图
public static void changeOtherAccount() {
     ResultSet rs;
     PreparedStatement preSql;
     Connection con3=new DBconn().getConn();
     String sql="update user set name=?,password=? where account=?";
     try {
         String account=ChangeAccountMessage.accounttext.getText();
         
         String name=ChangeAccountMessage.nametext.getText();
     
         String password=new String(ChangeAccountMessage.passwordtext.getPassword());
         
        preSql=con3.prepareStatement(sql);
        preSql.setString(1,name);
        preSql.setString(2,password);
        preSql.setString(3,account);
        boolean ok=preSql.execute(sql);
        
        System.out.println(ok);
    } catch (SQLException e) {
        System.out.println(e);
    }
 }
运行结果及报错内容

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 '?,password=? where account=?' at line 1

我的解答思路和尝试过的方法

暂时没有

我想要达到的结果

数据更新成功

没用过你这个mysql写法.但是看SQL语句的那个?号值是没赋上.preSql是设置值.然后preSql.excuteUpdate(Sql),这里是不是不对劲
现在的报错语句是这样的

img

看报错信息是语法错误,检查下name,password,account是不是没有值。还有可以试试把name,password,account三个代入上面的sql中,自己执行下

near '?,password=? where account=?' at line 1 你查询语句是这样写的,正确的是 用and

眼熟不?

img