op_bookclass.java~3~
资源名称:bookshop.zip [点击查看]
上传用户:sxlinghang
上传日期:2022-07-20
资源大小:1405k
文件大小:2k
源码类别:
数据库编程
开发平台:
Java
- package bookshop.run;
- /**
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2004</p>
- * <p>Company: </p>
- * @author not attributable
- * @version 1.0
- */
- import java.util.*;
- import bookshop.util.*;
- import bookshop.book.*;
- import java.sql.*;
- public class op_bookclass extends DataBase{
- public op_bookclass() {
- }
- private Vector classlist; //图书类别向量数组
- public Vector getClasslist() {
- return classlist;
- }
- public String getBookClassSql() {
- sqlStr = "select id,classname from bookclass order by id";
- return sqlStr;
- }
- public boolean seachBookClass() throws Exception {
- int id = 0;
- String classname = "";
- int rscount = 0;
- try {
- DataBase db = new DataBase();
- db.connect();
- stmt = db.conn.createStatement ();
- rs = stmt.executeQuery(getBookClassSql());
- rscount = stmt.getMaxRows();
- classlist = new Vector(rscount+1);
- classlist.clear();
- while (rs.next()){
- id = rs.getInt("id");
- classname = rs.getString("classname");
- bookclass bc = new bookclass(id,classname);
- classlist.addElement(bc);
- }
- rs.close();
- return true;
- }
- catch (SQLException sqle){
- System.out.println(sqle);
- return false;
- }
- }
- };