要看你用的什么数据库和什么驱动程序了。
如果是大型数据库都有支持的方法,
不然
ResultSet.last();
int count=Resultset.getRow();

解决方案 »

  1.   

    还有一个笨的方法,如用jdbc-odbc连Access数据库:
    int rowscount = 0;
    try
    {
        while (rs.next())
        {
    rowscount++;
        }
    }
    catch (Exception e)
    {
        out.println("e.getMessage()=" + e.getMessage());
    }
      

  2.   

    String sqlA = "select count(wk_id) as a from ID_CARD_PHOTO where wk_id='" + wkId + "'";
          Statement stmt = conn.createStatement();
          ResultSet  rsA = stmt.executeQuery(sqlA);
          rsA.next();
          int iTmp = new Integer(rsA.getString("a")).intValue();
          System.out.println(iTmp);
          rsA.close();
    //iTmp就是你所要的条数
      

  3.   

    to feyu2000(秋水无痕):那大型数据库中用什么方法呢?我在API中好象没有找到得到记录数的方法。我也在用
    ResultSet.last();
    int count=Resultset.getRow();