package Example; import java.sql.Date; import java.util.*; import java.sql.*; import bean.*; import db.*;
/** * <p>Title: </p> * * <p>Description: </p> * * <p>Copyright: Copyright (c) 2007</p> * * <p>Company: </p> * * @author not attributable * @version 1.0 */ public class ExampleAsset { private DBOper db = null; private ResultSet rs = null; public ExampleAsset() { } /* *将数据从数据库中按条件取出存入Vector数组中 */ public Vector SearchEorR(String SQL,AssetBean bean){ Vector objvct=new Vector(); Vector objvct1=new Vector(); db=new DBOper(); try { db.createPreparedStatement(SQL); db.setString(1,bean.getSortBean()); rs=db.executeQuery(); while (rs.next()) { objvct = new Vector(); objvct.add(rs.getString(1));//设备编号 objvct.add(rs.getString(2));//名称 objvct.add(rs.getString(3));//类别 objvct.add(rs.getString(4));//型号 objvct.add(rs.getInt(5));//数量 objvct.add(rs.getFloat(6));//价值 objvct1.add(objvct); } }catch (Exception ex) { ex.printStackTrace(); }finally{ db.closeAll(); } return objvct1; } /* *将数据从数据库中取出存入Vector数组中 */ public Vector SearchEorR1(String SQL){ Vector objvct=new Vector(); Vector objvct1=new Vector(); db=new DBOper(); try { db.createPreparedStatement(SQL); rs=db.executeQuery(); while (rs.next()) { objvct=new Vector(); objvct.add(rs.getString(1));//设备编号 objvct.add(rs.getString(2));//名称 objvct.add(rs.getString(3));//类别 objvct.add(rs.getString(4));//型号 objvct.add(rs.getInt(5));//数量 objvct.add(rs.getFloat(6));//价值 objvct1.add(objvct); } }catch (Exception ex) { ex.printStackTrace(); }finally{ db.closeAll(); } return objvct1; } /* *下拉筐 */ public ArrayList arryListSort(String SQL2){ ArrayList listSort = new ArrayList(); db=new DBOper(); try{ db.createPreparedStatement(SQL2); rs=db.executeQuery(); while (rs.next()){ listSort.add(rs.getString(1)); } } catch(Exception ex){ ex.printStackTrace(); } finally{ db.closeAll(); } return listSort; } /* *更新库存物资表中的数量 */ public int update(String SQL3,int count1,AssetBean bean){ int count=0; db= new DBOper(); try{ db.createPreparedStatement(SQL3); db.setInt(1,count1); db.setString(2,bean.getSortBean()); count=db.executeUpdate(); } catch(Exception e){ e.printStackTrace(); } finally{ db.closeAll(); } return count; } /* * *插入数据 */ public int insert(String SQL4,String number,String day1,String AD,String purpose,String remark,String name){ int count=0; db= new DBOper(); try{ db.createPreparedStatement(SQL4); db.setString(1,number); db.setString(2,day1); db.setString(3,AD); db.setString(4,purpose); db.setString(5,remark); db.setString(6,name); count=db.executeUpdate(); } catch(Exception e){ e.printStackTrace(); } finally{ db.closeAll(); } return count; }
/** * update * * @param SQLCOUNT String * @param countC int * @param beanAsset AssetBean * @return int */ }
|
发表评论 取消回复