strSQL="select count(*) as total from table"rs.getInt("total")

解决方案 »

  1.   

    What about the following ?rs.last();
    int iRowCnt = rs.getRow(); //the row count is here :-)
    rs.beforeFirst();
    ...
    //begin normal process.
    rs.next() ...
      

  2.   

    select tab_1.*,tab_2.* from
    (
      (select * from xxx where ....)tab_1,
      (select count(*) from xxx where ...)tab_2,
    )
      

  3.   

    使用strSQL="select count(*) as total from table"
    rs.getInt("total") 比较好!
    如果使用 ResultSet rs = stmt.ExecuteQuery(strSql);
    rs.last();
    int iRowCnt = rs.getRow(); 需要java2支持!所以我建议使用
    count() 
      

  4.   

    ResultSet实际上是游标,并没有把所有数据都提出来,所以用一个查询返回满足条件的行数较安全。