자바 웹 페이지 기반 sql 2005 데이터베이스

sql 구문
/**
 *        
 *        ID     
 *     
 * status : 1   =       ; 0          

 * 
 */

public List findPageing(String MemberID,int maxPageSize,int startPage,int status){
    List<ProduceStockDateVo> list = new ArrayList<ProduceStockDateVo>();
    ProduceStockDateVo vo=null;
    String sqlDown="select  top  "+maxPageSize+"  *  from  produceStock_date where id>=? and MemberID=? order by id asc";//     :          ---   id          --         --     
    String sqlUp="select  top  "+maxPageSize+"  *  from  produceStock_date where id<? and MemberID=? order by id desc";
    try{
        if(status==1){
            pst=con.prepareStatement(sqlDown);
        }else{
            pst=con.prepareStatement(sqlUp);
        }
        pst.setInt(1, startPage);
        pst.setString(2, MemberID);
        rs=pst.executeQuery();
        while(rs.next()){
            vo=new ProduceStockDateVo();
            this.putRsToVo(rs, vo);
            list.add(vo);
        }
    }catch(Exception e){
        e.printStackTrace();
    }
    return list!=null?list:null;
}

좋은 웹페이지 즐겨찾기