检查resultset是否用了last(),或者循环到了结果集末尾,在这之后再对结果集进行取值操作会产生此错误,贴出你的代码

解决方案 »

  1.   

    下面是我的代码,很乱,不知道能不能有用!String CC_STATEMENT = "select count(*) from napininfo where dtn = ?";
    String CS_STATEMENT = "select napininfo.kind,napininfo.proid,napininfo.zwsid,napininfo.bundle_n,napininfo.num_n,napininfo.usaprice,napininfo.usamoney_n,napininfo.japprice,"
                               +"napininfo.japmoney_n,napininfo.fanpin,productinfo.pdtname,productinfo.grade,productinfo.pdtcode,zws.zwscode from "
                               +"napininfo,productinfo,zws where napininfo.proid = productinfo.pdtid and napininfo.zwsid = zws.zwsid and napininfo.dtn =? order by napininfo.fanpin";//得到子纪录集的条数
          ps = conn.prepareStatement(CC_STATEMENT);
          ps.setString(1,conditionString);
          childRS = ps.executeQuery();
          childRS.next();                            //记录集中指的第一条纪录不是真正的有效纪录
          int total = childRS.getInt(1);
          childRS.close();
          ps.close();
          //获得数据
          ps = conn.prepareStatement(CS_STATEMENT);
          ps.setString(1,conditionString);
          childRS = ps.executeQuery();
          if(start >= 0 && start < total){
            List items = new ArrayList();    //存放正品和返品
            List itemsFanPin = new ArrayList();   //存放返品
            //rs.absolute(start + 1);jdbc2.0不支持这个方法
            //这个循环的作用是把游标移到想要操作的位置
            while(copyStart-- >= 0){
              childRS.next();
            }
            //因为在jdbc2.0中记录集的移动没有一个判断结束的标志
            if((start + count) > total ){
              count = total - start;
            }
            int kindType = 0;
            String strProductClassify;
            while(count-- > 0){
              kindType = childRS.getInt("kind");
              if(kindType == 1){
                strProductClassify = "加工品";
              }else{
                strProductClassify = "非加工品";
              }
              pci = new ProductChildInfo(strProductClassify,childRS.getString("pdtcode"),childRS.getString("grade"),childRS.getString("pdtname"),childRS.getString("zwscode"),
                  childRS.getInt("bundle_n"),childRS.getInt("num_n"),childRS.getFloat("usaprice"),childRS.getFloat("usamoney_n"),childRS.getFloat("japprice"),
                  childRS.getFloat("japmoney_n"),PRODUCT_NOACTION,childRS.getInt("fanpin"));
              pci.setProID(childRS.getInt("proid"));
              pci.setZwsID(childRS.getInt("zwsid"));
              items.add(pci);
            //往items变量中加入纪录
              childRS.next();
            }
      

  2.   

    在第一个while循环的地方就出现resultset用尽的提示
      

  3.   

    copyStart是个什么东东?
    不会比记录集总数还大吧?
      

  4.   

    是不是在进行真正数据检索前,执行这两句话有问题      
          childRS.close();
          ps.close();
          //获得数据