![](https://csdnimg.cn/release/download_crawler_static/86352886/bg7.jpg)
*
根据课程名删除一条记录
*/
public boolean deleteCourse(String string) throws SQLException {
String sql = "delete from 课程 where name = ?";
//SQL
查询 返回受影响的行数
int row = queryRunner.update(sql,string);
//
如果受影响的行数为正整数,那么删除记录成功
if(row>0) {
return true;
}else {
return false;
}
}
/**
*
更改一条记录
*/
public boolean updateCourse(int id,Course course) throws SQLException {
String sql = "update 课程 set id = ? ,name = ? ,studyTime = ?, studyGrade = ? where id = ?";
//SQL
查询 返回受影响的行数
int row =
queryRunner.update(sql,course.getId(),course.getName(),course.getStudyTime(),course.getStudyGrade(
),id);
//
如果受影响的行数为正整数,那么更改记录成功
if(row>0){
return true;
}else {
return false;
}
}
}
8. 导入图片到 image 文件夹,方便后续代码获取主界面背景