1.Statement stmt=conn.createStatement();
将这句改为:
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE);
你可以查一下帮助文档,
createStatement()中被重载过了,如果不加参数,则默认为不支持记录集滚动,
上面两参数的意识是说:
ResultSet.TYPE_SCROLL_SENSITIVE:可以让光标随意移动,
CONCUR_UPDATABLE:可以通过ResultSet对象操作记录集
将这句改为:
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE);
你可以查一下帮助文档,
createStatement()中被重载过了,如果不加参数,则默认为不支持记录集滚动,
上面两参数的意识是说:
ResultSet.TYPE_SCROLL_SENSITIVE:可以让光标随意移动,
CONCUR_UPDATABLE:可以通过ResultSet对象操作记录集
解决方案 »
- JSP嵌套MSSQL的insert执行过不去
- MyEclipse问题(急!!)
- 怎么会找不到方法呢?请各位高人指教,谢谢了.
- accpedu(四爷)请进,iTextAsian.jar包下载的分(2)
- 一个自动问题
- 紧急问题:我级联数据表怎么查数据库有问题呢???
- 想在jsp页面中包含2个html的页面,有方法吗?
- linux+apache+tomcat下发送邮件的奇怪问题!!
- 高分请教高手:如何将Excel表单通过jsp嵌入到IE(或者Netscape)中
- 急急急!谁用过TOMCAT + IIS ???????
- Eclipse的使用问题:
- 如何用正则表达式实现第一个字母只能是字母,后面的只能是字母和数字??
接楼主帖,请问象二楼的方法是否同样适用SQL 2000 SERVER???
用了二楼的方法是否使SQL 2000也支持rs.last()????
多谢
Result sets created using the returned Statement object will by default be type TYPE_FORWARD_ONLY and have a concurrency level of CONCUR_READ_ONLY. createStatement(int resultSetType,int resultSetConcurrency)resultSetType - a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetConcurrency - a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
文档:
previous
public boolean previous()
throws SQLExceptionMoves the cursor to the previous row in this ResultSet object. Returns:
true if the cursor is on a valid row; false if it is off the result set
Throws:
SQLException - if a database access error occurs or the result set type is TYPE_FORWARD_ONLY