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

📄 opwarehouse.java

📁 很好的东东 本人随便做的 仅供学习之用
💻 JAVA
字号:
package chuyun.operatedata;

import java.sql.SQLException;
import java.util.ArrayList;
import java.sql.*;


import chuyun.form.warehouse;
import chuyun.javabeans.OperateDataBase;

public class Opwarehouse {
	 
	
	public Opwarehouse(){
		opdb = new OperateDataBase();
		
	}
	public 	OperateDataBase opdb=null;
	private ResultSet rcount=null;
	private ResultSet rs1=null;
	public  static int pagenum=1;
	private int pagecounts = 0;
	private int begin = 0;//first

	private int end = 0; //last

	private int pagelast = 0;
	private  ArrayList<warehouse> temp = new ArrayList<warehouse>();
	public ArrayList<warehouse> querywarehouse( int page,int count) {

		try {

			
			rcount = opdb.getMyResultSet("SELECT count(id) as ids from warehouse");
			if (rcount.next())
				pagecounts = rcount.getInt("ids");

			if (pagecounts % count == 0) {
				pagenum = pagecounts / count;
			} else {
				pagenum = pagecounts / count + 1;
				pagelast = pagecounts / count;
			}
			//int begin = page * count - count;
			//int end = page * count;
			if (page == pagenum) {
				end = pagecounts;
			}

			rs1 = opdb.getMyResultSet("select * from warehouse");
			try {				  
				rs1.absolute((page -1)* count );
				for (int i = 1; i <= count; i++) {
					if (rs1.next()) {
						warehouse wh = new warehouse();
						wh.setID(rs1.getInt(1));
						wh.setAddress(rs1.getString(2));
						wh.setTel(rs1.getString(3));
						wh.setPrincipalID(rs1.getInt(4));
						wh.setPrincipal(rs1.getString(5));
						wh.setWarehouse(rs1.getString(6));
						
						
						temp.add(wh);
						
					}//for10

				}//if

			}//try

			catch (SQLException ex) {
				ex.printStackTrace();
			}
			opdb.Dispose();
			

		} catch (Exception ex) {
			temp = null;
			ex.printStackTrace();
		}
		return temp;
	}

}

⌨️ 快捷键说明

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