11月15日

今天对只修改记录中的某几个字段的数据有了了解,

String sql="update rkpc set idnum=?,sex=?,mz=?,shoujiao=? where name=?";
preparedStatement=conn.prepareStatement(sql);
preparedStatement.setString(5, ac.getName());

preparedStatement.setString(1, ac.getIdnum());
preparedStatement.setString(2, ac.getSex());
preparedStatement.setString(3, ac.getMz());
preparedStatement.setString(4, ac.getShoujiao());

列如通过name来进行位置确定对需要的字段进行修改,setString()中的数字的次序代表问号的次序。

posted @ 2020-11-15 21:44  不咬牙  阅读(38)  评论(0编辑  收藏  举报