1、修改窗体
2、在StudentDao中增加根据修改学生信息的方法
/** * 修改的方法 * * @param student * @return * @throws SQLException */ public boolean editStudent(Student student) throws SQLException { DbUtil dbUtil = new DbUtil(); String sql = "update tb_student (name,sno,sex,classname) values ('" + student.getName() + "','" + student.getSno() + "','" + student.getSex() + "','" + student.getClassName() + "') where id ='" + student.getId() + "'"; //在控制台打印sql语句用于检查 System.out.println(sql); //处理并返回 return dbUtil.execute(sql); }
3、在StudentService中增加服务
/** * 修改学生信息服务 * * @param student * @return * @throws SQLException */ public boolean editStudent(Student student) throws SQLException { StudentDao studentDao = new StudentDao(); return studentDao.update(student); }