把API先贴出来给你看看public boolean isLast() throws SQLException Retrieves whether the cursor is on the last row of this ResultSet object. Note: Calling the method isLast may be expensive because the JDBC driver might need to fetch ahead one row in order to determine whether the current row is the last row in the result set. Returns: true if the cursor is on the last row; false otherwise Throws: SQLException - if a database access error occurs 我觉得是不是: while(rs.next()){ if(rs.isLast()==true){ dosomething.... } }
Retrieves whether the cursor is on the last row of this ResultSet object. Note: Calling the method isLast may be expensive because the JDBC driver might need to fetch ahead one row in order to determine whether the current row is the last row in the result set. Returns:
true if the cursor is on the last row; false otherwise
Throws:
SQLException - if a database access error occurs
我觉得是不是:
while(rs.next()){
if(rs.isLast()==true){
dosomething....
}
}
在我的程序里面:
while(rs.next())
{
if(rs.isLast())
{
}
}就出现错误。
如果:
while(rs.next())
{
rs.isFirst();
{
}
}
没问题!