ResultSet 对象中得到记录集的方法是什么? ResultSet 对象中得到记录集的方法是什么? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ResultSet不就是记录集吗,还想得到什么,放到Collection中去? ResultSet 就是记录集。楼主是指什么? ResultSet 就是记录集。楼主是指什么? 想得到里面的数据不难。ResultSet rs=....while(rs.next()){ rs.getString(1);//得到结果} resultset.last();int c = resultset.getRow(); 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();//得到最后一条的行数。也就是记录总数} 不好意思,我把自己写的东西直接发上去了,用习惯了^_^完整的: public int getRecordCount() throws SQLException { int countRow; if(rs==null) throw new SQLException("数据集为空!!"); rs.last(); countRow=rs.getRow(); rs.beforeFirst(); return countRow; } 不好意思/。上面我的发言中。这句请更正ResultSet = stmt.executeQuery("sql语句");应该是:ResultSet rs = stmt.executeQuery("sql语句"); 奇怪,myeclipse blue将文件提交到svn后,本地文件回退到旧的版本? jsp BeanUtils.populateBean 更改tomcat默认主页问题 试了N次 但我还是失败了 tomcat显示如下错误.请求帮助 两个数组合并方法 Tomcat从Windows到Linux移植代码问题 菜鸟问题!一个关于站点设计的问题! 关于自定义beans??? 有谁做过数据库读取时等待的进度条!急!原理是什么?达人请进! 纯java邮件系统开通,欢迎测试!![来自jspchina.com的消息] 查询分页显示,回显问题!!!!!!!! jsp连接mysql数据需要什么软件?
ResultSet rs=....
while(rs.next()){
rs.getString(1);//得到结果
}
int c = resultset.getRow();
然后
ResultSet = stmt.executeQuery("sql语句");
while(rs.next())
{
rs.last();//移动到最后
int count =rs.getRow();//得到最后一条的行数。也就是记录总数
}
完整的: public int getRecordCount() throws SQLException
{
int countRow;
if(rs==null)
throw new SQLException("数据集为空!!");
rs.last();
countRow=rs.getRow();
rs.beforeFirst();
return countRow;
}
ResultSet = stmt.executeQuery("sql语句");
应该是:
ResultSet rs = stmt.executeQuery("sql语句");