看看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
select count(*) from table rs.getString(0)
int counter = 0; while(rs.next()){ counter ++; ........... }
看看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
rs.getString(0)
while(rs.next()){
counter ++;
...........
}