absolute
public boolean absolute(int row)
throws SQLException
Moves the cursor to the given row number in this ResultSet object.
If the row number is positive, the cursor moves to the given row number with respect to the beginning of the result set. The first row is row 1, the second is row 2, and so on. If the given row number is negative, the cursor moves to an absolute row position with respect to the end of the result set. For example, calling the method absolute(-1) positions the cursor on the last row; calling the method absolute(-2) moves the cursor to the next-to-last row, and so on. An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before the first row or after the last row. Note: Calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling last().Returns:
true if the cursor is on the result set; false otherwise我想,是不是可以用rs.absolute(int i)定位cursor,然后rs.getXXX(),就可以了?
public boolean absolute(int row)
throws SQLException
Moves the cursor to the given row number in this ResultSet object.
If the row number is positive, the cursor moves to the given row number with respect to the beginning of the result set. The first row is row 1, the second is row 2, and so on. If the given row number is negative, the cursor moves to an absolute row position with respect to the end of the result set. For example, calling the method absolute(-1) positions the cursor on the last row; calling the method absolute(-2) moves the cursor to the next-to-last row, and so on. An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before the first row or after the last row. Note: Calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling last().Returns:
true if the cursor is on the result set; false otherwise我想,是不是可以用rs.absolute(int i)定位cursor,然后rs.getXXX(),就可以了?
解决方案 »
- 求助关于SWING组件按钮提交事件显示不同的标签
- ibatis 在ibatis中如何返回一个String类型的list集合
- 关于线程的优先级,高手进来回答下, 谢谢了
- 初学者提问
- JTextArea没有ScrollBar有什么好处?不是比TextArea烂吗?
- 如何实现字体的立体效果啊!
- httpclient
- interface可以为空??
- 请问:静态方法能否被改写?(在线)
- 比较菜鸟的问题我怎么在jsp或javabean中得到前面提交过来的那一页的URL
- 怎样用java实现操作系统中类似信号量的类?
- 我是初学者,请各位前辈帮忙.我把数组中的内容显示在文本域里,当数据多的时候,他显示一部分就不动了,为什么?如何解决??十万火急,!!!!!!
多少条记录?
只是对于resultset接口来说,没有这个method
那么.....是不是只有last()之后再getRow()了吧。
rs.getInt(1);
先select count(*) from table_name where conditions
然后rs.getInt(1)
我的感觉就是,用Java搞数据库开发,一定要先把SQL语句学清楚,一点建议。
是在不行了,才去改sql的
:vrsky(星雨) (2001-6-4 18:27:00) 得0分
一个笨方法,while(re.next()){count++;} :-)
这个循环, 当然这个循环也有它一定的缺陷性。
散分了!