for the right syntax to use near '?where id=?',利用javaWeb做项目时出现前面的状况,这是什么问题?

代码:

Connection conn =DBHelper.getConnection();

String sql = "update userinfo set balance=?"+"where id=?";

PreparedStatement ps = (PreparedStatement) conn.prepareStatement(sql);

ps.setDouble(1, balance);

ps.setInt(2, id);

ps.executeUpdate(sql);


忍帅锅
浏览 3705回答 3
3回答

zzZerOrz

问号和where连起来了,拼接后是?where,中间需要一个空格
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

MySQL