while(rs,next()){    //加上着句
System.out.println(rs.getRow());//为什么为0啊,数据库里有记录????
   
    while(rs.next())
    {
    System.out.println(rs.getString("f_treename"));
    }
    for(int i=0;i<rs.getRow();i++)
    {
   
    }   
    }
    catch(Exception e)
    {
    e.printStackTrace();
    }

解决方案 »

  1.   

    只能用select count(*)或者while(rs.next())里面计数来实现
      

  2.   

    agree 楼上的,没其他办法咯
      

  3.   

    getRow()是返回行号~~
            
    看看API DOCUMENTION的描述吧getRow
    public int getRow()
               throws SQLException
    Retrieves the current row number. The first row is number 1, the second number 2, and so on.
    Returns:
    the current row number; 0 if there is no current row
    Throws:
    SQLException - if a database access error occurs
      

  4.   

    select count(*) from table 
    rs.getString(0)
      

  5.   

    int counter = 0;
    while(rs.next()){
    counter ++;
    ...........
    }