日期:2014-05-17  浏览次数:20696 次

大家帮忙看看这oracle代码错在哪里?
public ArrayList<Product> hclassselect(int currpage,int count)
     {  
       ArrayList<Product> list=new ArrayList<Product>();
       Connection conn=BaseDao.getConn();
      PreparedStatement  ps=null;
      ResultSet rs=null;
      Product  p=null;
      try {
      ps = conn.prepareStatement("select * from (select epc_name,epc_class_id,et_type,et_id"+    
       "from (select a.epc_name,a.epc_id,b.* from easybuy_pclass a,easybuy_ptype b" +
      " where a.epc_class_id=b.epc_class_id order by b.et_id))" +
      "where et_id between"+((currpage-1)*count+1)+"and"+currpage*count); 
      rs = ps.executeQuery();
       while(rs.next())
       {
       p=new Product();
       p.setFid(rs.getInt("epc_class_id"));
       p.setFname(rs.getString("epc_name"));
       p.setSid(rs.getInt("et_id"));
       p.setSname(rs.getString("et_name"));
        list.add(p);
       }

} catch (Exception e) {
 e.printStackTrace();
}
  finally
  {
 BaseDao.closeAll(rs, ps, conn);
  }
      return list;
     }

  rs总是为null怎么搞的
------解决方案--------------------
是不是报异常了,还有你拼的语句是不是少了空格了,造成异常了
------解决方案--------------------
 "where et_id between"+((currpage-1)*count+1)+"and"+currpage*count);  
明显少了空格。。。。。