获取Resultset记录数

PreparedStatement pstmt = null;
ResultSet rs = null;
pstmt = conn.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);  
rs = pstmt.executeQuery();

rs.last(); 
int count = rs.getRow(); 
rs.beforeFirst();

 

你可能感兴趣的:(sql)