Java课程设计---删除学生

1、界面已经在上次修改操作的过程添加完成

2、在StudentDao中添加删除方法

	public boolean delete(int id) throws SQLException {
		DbUtil dbUtil = new DbUtil();
		//sql
		String sql = "delete from tb_student where id ='" + id + "'";
		// 在控制台打印sql语句用于检查
		System.out.println(sql);
		// 处理并返回
		return dbUtil.execute(sql);
	}

3、在StudentService中添加删除用户服务

	
	/**
	 * 根据id删除学生
	 * @param id
	 * @return
	 * @throws SQLException 
	 */
	public boolean deleteStudent(int id) throws SQLException {
		StudentDao studentDao = new StudentDao();
		return studentDao.delete(id);
	}

 

猜你喜欢

转载自www.cnblogs.com/daxiang2008/p/9214341.html
今日推荐