public void creat(Reader rd) { Connection cn = null; PreparedStatement ps = null; try { cn = JDBCTools.getConnection(); String spl = "insert into reader(r_id,r_password,r_name,r_age,r_typed,r_sex,r_dept,r_phone,r_address,r_photo)values(?,?,?,?,?,?,?,?,?,?)"; ps = cn.prepareStatement(spl); ps.setString(1, rd.getReaderid()); ps.setString(2, rd.getPassword()); ps.setString(3, rd.getName()); ps.setInt(4, rd.getAge()); ps.setInt(5, rd.getTyped()); ps.setString(6, rd.getSex()); ps.setString(7, rd.getDept()); ps.setString(8, rd.getPhone()); ps.setString(9, rd.getAddress()); ps.setString(10, rd.getPhoto()); ps.executeUpdate(); } catch (SQLException e) { throw new DaoException(); } finally { JDBCTools.free(ps, cn); } }