mybatis

String sql = "update FirstTest set quan=? where name=?";
PreparedStatement ps = DBconnect.connect(sql);
try {
ps.setString(1,quan);
ps.setString(2,name);
ps.executeUpdate();

 

ps.executeUpdate();不能有参数sql,否则会报错:没有将所有参数绑定(绑定指将?替换的过程)

posted @ 2017-09-04 11:25  新生的小心情  阅读(107)  评论(0编辑  收藏  举报