为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

忍帅锅 2018-04-30 17:38:48
代码: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);
查看完整描述

3 回答

已采纳
?
zzZerOrz

TA贡献101条经验 获得超28个赞

问号和where连起来了,拼接后是?where,中间需要一个空格

查看完整回答
1 反对 回复 2018-04-30
  • 忍帅锅
    忍帅锅
    String sql = "update userinfo set balance=? "+" where id=?"; 这样写对吗?
  • zzZerOrz
    zzZerOrz
    嗯嗯,对的
  • 忍帅锅
    忍帅锅
    还是不行,可能是版本有问题,弄了一下午了
点击展开后面3
  • 3 回答
  • 0 关注
  • 3693 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信