`

jdbc中获取resultset的大小

    博客分类:
  • java
 
阅读更多

ResultSet rs = ps.executeQuery();
int rowcount = 0;
if (rs.last()) {
  rowcount = rs.getRow();
  rs.beforeFirst(); // not rs.first() because the rs.next() below will move on, missing the first element
}
while (rs.next()) {
  // do your standard per row stuff
}
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics