ResultSet 对象中得到记录集的方法是什么?

j357777842 2006-02-27 09:28:33
ResultSet 对象中得到记录集的方法是什么?
...全文
170 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
jspfans 2006-03-01
  • 打赏
  • 举报
回复
不好意思,我把自己写的东西直接发上去了,用习惯了^_^
完整的:

public int getRecordCount() throws SQLException
{
int countRow;
if(rs==null)
throw new SQLException("数据集为空!!");
rs.last();
countRow=rs.getRow();
rs.beforeFirst();
return countRow;
}
725137 2006-03-01
  • 打赏
  • 举报
回复
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);//先加上这句。。设置ResultSet的可滚动.
然后
ResultSet = stmt.executeQuery("sql语句");
while(rs.next())
{
rs.last();//移动到最后
int count =rs.getRow();//得到最后一条的行数。也就是记录总数
}
zeq258 2006-03-01
  • 打赏
  • 举报
回复
这些难道还不清楚吗?
believefym 2006-03-01
  • 打赏
  • 举报
回复
resultset.last();
int c = resultset.getRow();
725137 2006-03-01
  • 打赏
  • 举报
回复
不好意思/。上面我的发言中。这句请更正
ResultSet = stmt.executeQuery("sql语句");
应该是:
ResultSet rs = stmt.executeQuery("sql语句");
xiaye0908 2006-02-28
  • 打赏
  • 举报
回复
想得到里面的数据不难。
ResultSet rs=....
while(rs.next()){
rs.getString(1);//得到结果
}
wanglin824 2006-02-28
  • 打赏
  • 举报
回复
ResultSet==记录集
jspfans 2006-02-28
  • 打赏
  • 举报
回复
getRecordCount()
j357777842 2006-02-28
  • 打赏
  • 举报
回复
哦,我是想得到记录集中记录的个数,可我怎么也找不到是哪个方法
infowain 2006-02-28
  • 打赏
  • 举报
回复
楼主在骑马找马
doway 2006-02-27
  • 打赏
  • 举报
回复
ResultSet 就是记录集。楼主是指什么?
doway 2006-02-27
  • 打赏
  • 举报
回复
ResultSet 就是记录集。楼主是指什么?
believefym 2006-02-27
  • 打赏
  • 举报
回复
ResultSet不就是记录集吗,还想得到什么,放到Collection中去?

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧