CourseType.java
上传用户:jishiqi_cj
上传日期:2022-08-08
资源大小:24765k
文件大小:1k
- package StudyCourse;
- import java.util.*;
- import java.sql.ResultSet;
- public class CourseType{
-
- protected int id;
- protected String courseType ;
-
- public CourseType(){ }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public int getId(){
- return id;
- }
-
- public void setCourseType(String courseType) {
- this.courseType = courseType;
- }
-
- public String getCourseType(){
- return courseType;
- }
-
-
- public static Vector SearchCourseType(DB db) throws Exception{
- Vector courseTypeList = new Vector();
- ResultSet rs;
- String strSql=null;
-
- strSql = "select * from coursetype";
- rs = db.OpenSql(strSql);
-
- while (rs.next()){
- CourseType courseType = new CourseType();
-
- courseType.setId(rs.getInt("id")) ;
- courseType.setCourseType(rs.getString("name")) ;
-
- courseTypeList.add(courseType);
- }
- System.out.println("courseTypeList: "+courseTypeList.size());
-
- return courseTypeList;
- }
-
- public static int GetFirstCourseType(DB db) throws Exception{
- ResultSet rs;
- String strSql=null;
-
- strSql = "select * from coursetype";
- rs = db.OpenSql(strSql);
-
- if (rs.next()){
- return rs.getInt("id");
- }
- else
- return 0;
- }
- }