PublishingDAO.java
资源名称:Library.rar [点击查看]
上传用户:ycdfsj258
上传日期:2022-08-04
资源大小:1094k
文件大小:1k
源码类别:
图形图象
开发平台:
Java
- package com.dao;
- import com.core.ConnDB;
- import java.util.*;
- import java.sql.*;
- import com.actionForm.PublishingForm;
- public class PublishingDAO {
- private ConnDB conn=new ConnDB();
- //查询数据
- public Collection query(String strif){
- PublishingForm pubForm=null;
- Collection pubColl=new ArrayList();
- String sql="";
- if(strif!="all" && strif!=null && strif!=""){
- sql="select * from tb_publishing where "+strif+"";
- }else{
- sql="select * from tb_publishing";
- }
- ResultSet rs=conn.executeQuery(sql);
- try {
- while (rs.next()) {
- pubForm=new PublishingForm();
- pubForm.setIsbn(rs.getString(1));
- pubForm.setPubname(rs.getString(2));
- pubColl.add(pubForm);
- }
- } catch (SQLException ex) {
- }
- conn.close();
- return pubColl;
- }
- }