Java课程设计---修改学生基本信息

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);
	}

  

猜你喜欢

转载自www.cnblogs.com/daxiang2008/p/9213940.html