⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 books.java

📁 eclipse+struts+sqlserver 简单图书管理系统,内有文档
💻 JAVA
字号:
package kignbi.dong;

//import java.sql.ResultSet;
//import java.util.Vector;

public class Books {
	
	private String bid;
	private String bname;
	private String bkind;
	private String bpublish;
	private String bauthor;
	private float  bprice;
    private int    bnumber;
    private String bdt_publish;
   
    
	public int getBnumber() {
		return bnumber;
	}
	public void setBnumber(int bnumber) {
		this.bnumber = bnumber;
	}
	public String getBauthor() {
		return bauthor;
	}
	public void setBauthor(String bauthor) {
		this.bauthor = bauthor;
	}
	public String getBdt_publish() {
		return bdt_publish;
	}
	public void setBdt_publish(String bdt_publish) {
		this.bdt_publish = bdt_publish;
	}
	public String getBid() {
		return bid;
	}
	public void setBid(String bid) {
		this.bid = bid;
	}
	public String getBkind() {
		return bkind;
	}
	public void setBkind(String bkind) {
		this.bkind = bkind;
	}
	public String getBname() {
		return bname;
	}
	public void setBname(String bname) {
		this.bname = bname;
	}
	public float getBprice() {
		return bprice;
	}
	public void setBprice(float bprice) {
		this.bprice = bprice;
	}
	public String getBpublish() {
		return bpublish;
	}
	public void setBpublish(String bpublish) {
		this.bpublish = bpublish;
	}
	////所有图书
	/*public static Vector allBooks(DB db) throws Exception {
			Vector Books = new Vector();
			ResultSet rs;
			String strSql = null;

			strSql = "select * from books where bnumber>=1";
			rs = db.OpenSql(strSql);

			while (rs.next()) {
				Books book = new Books();
				book.setBid(rs.getString("bid"));
				book.setBname(rs.getString("bname"));
				book.setBkind(rs.getString("bkind"));
                book.setBpublish(rs.getString("bpublish"));
                book.setBauthor(rs.getString("bauthor"));
                book.setBprice(rs.getFloat("bprice"));
                book.setBnumber(rs.getInt("bnumber"));
                book.setBdt_publish(rs.getString("bdt_publish"));
				Books.add(book);
			}
			return Books;
		}
	public static Books search(DB db, String bid, String bname)
	throws Exception {
		ResultSet rs;
		String strSql = null;

		strSql = "select * from books where dbo.trim(bid)='" + bid + "' and bname = '"
		         +bname.trim()+"',and bnumber>0";
		rs = db.OpenSql(strSql);

		Books book = new Books();
		if (rs.next()) {
			book.setBid(rs.getString("bid"));
			book.setBname(rs.getString("bname"));
			book.setBkind(rs.getString("bkind"));
            book.setBpublish(rs.getString("bpublish"));
            book.setBauthor(rs.getString("bauthor"));
            book.setBprice(rs.getFloat("bprice"));
            book.setBnumber(rs.getInt("bnumber"));
		}
		return book;
	
	}
	public static Books search(DB db, String bid)
	throws Exception {
		ResultSet rs;
		String strSql = null;

		strSql = "select * from books where dbo.trim(bid)='" + bid + "',and bnumber>0";
		rs = db.OpenSql(strSql);

		Books book = new Books();
		if (rs.next()) {
			book.setBid(rs.getString("bid"));
			book.setBname(rs.getString("bname"));
			book.setBkind(rs.getString("bkind"));
            book.setBpublish(rs.getString("bpublish"));
            book.setBauthor(rs.getString("bauthor"));
            book.setBprice(rs.getFloat("bprice"));
            book.setBnumber(rs.getInt("bnumber"));
		}
		return book;
	
	}
	public static Vector Research(DB db, String bname)
	throws Exception {
		Vector Books = new Vector();
		ResultSet rs;
		String strSql = null;

		strSql = "select * from books where dbo.trim(bname) like '%" + bname + "%',and bnumber>0";
		rs = db.OpenSql(strSql);

		
		if (rs.next()) {
			Books book = new Books();
			book.setBid(rs.getString("bid"));
			book.setBname(rs.getString("bname"));
			book.setBkind(rs.getString("bkind"));
            book.setBpublish(rs.getString("bpublish"));
            book.setBauthor(rs.getString("bauthor"));
            book.setBprice(rs.getFloat("bprice"));
            book.setBnumber(rs.getInt("bnumber"));
            Books.add(book);
		}
		return Books;
	}
	public boolean edit(DB db,String bid,String bname,String bkind,
			String bpublish,String bauthor,float bprice,int bnumber) throws Exception {
		System.out.println("editing");
		String strSql;
		strSql = "update books set bname='"+bname+"',bkind='"
			+ bkind + "', bpublish=" + bpublish
				+ ", bauthor='" + bauthor + "', bprice='" + bprice
				+ "',bnumber="+bnumber+" where dbo.trim(bid)='" +bid+ "'";
		if (db.ExecSql(strSql) == 0) {
			return false;
		} else {
			return true;
		}
	}	
	
	
	
	
	
	
	
	
	public static boolean delete(DB db, String bid) throws Exception {
			String strSql;
			strSql = "delete from books where dbo.trim(bid)='" + bid + "'";
			if (db.ExecSql(strSql) == 0) {
				return false;
			} else {
				return true;
			}
	
	}
	
	
	
	
	
	
	
	*/
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -