关于Illegal operation on empty result set的问题

jimmy198810 2009-11-21 09:56:27
我刚开始学JSP,写了一个图书管理程序,在用ResultSet的时候出现了Illegal operation on empty result set异常,想请教一下各位高手出现这种异常的可能情况,谢谢!
...全文
4423 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
jimmy198810 2009-11-21
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 zhoupuyue 的回复:]
rs不是null,而是你从rs取数据的时候里面没数据,你可以到数据库中执行SQL看一下有没有数据,在程序中取数据的时候要先判断有没有值,再取。
[/Quote]
赞同,问题已经解决。
jimmy198810 2009-11-21
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 wind1373290 的回复:]
Java codeif(rs.next()) {
rs.getXXX(1);
...
}else {
System.out.println("no data.");
}
[/Quote]
我理解的是若查询的数据不存在,返回的ResultSet引用rs=null,既然不存在ResultSet对象就不能用next()方法,不过,我的理解错了,返回的结果是创建了ResultSet对象,只是在其中没有数据。我的问题解决了,谢谢!
阿_布 2009-11-21
  • 打赏
  • 举报
回复
rs不是null,而是你从rs取数据的时候里面没数据,你可以到数据库中执行SQL看一下有没有数据,在程序中取数据的时候要先判断有没有值,再取。
wind1373290 2009-11-21
  • 打赏
  • 举报
回复

if(rs.next()) {
rs.getXXX(1);
...
} else {
System.out.println("no data.");
}
jimmy198810 2009-11-21
  • 打赏
  • 举报
回复
我的代码是这样的:
searchStr="select * from bookinfo where bk_title='"+searchCondition+"'";
rs=stmt.executeQuery(searchStr);
是不是在数据库中若没有找到相应的数据,rs就会等于null?
qustgjk 2009-11-21
  • 打赏
  • 举报
回复
ResultSet为空,无法进行有效的操作
阿_布 2009-11-21
  • 打赏
  • 举报
回复
ResultSet结果集中没有值。
Delphi 7.1 Update Release Notes=======================================================This file contains important supplemental and late-breakinginformation that may not appear in the main productdocumentation, and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized version of Delphi 7, visit the Borland Registered User web site to obtain a localized readme file that may contain important late- breaking information not included in this readme file.IMPORTANT: Delphi must be closed before installing this update. =====================================================CONTENTS * INSTALLING THIS UPDATE * UPDATING LOCALIZED VERSIONS OF DELPHI 7 * KNOWN ISSUES * ISSUES ADDRESSED BY THIS UPDATE - IDE - CORE DATABASE - DATASNAP - DBGO (ADO COMPONENTS) - dbExpress - dbExpress COMPONENTS AND DB VCL - dbExpress CORE DRIVER AND METADATA - dbExpress VENDOR ISSUES - dbExpress CERTIFICATION - WEB SNAP - ACTIVEX - COMPILER - RTL - VCL - THIRD PARTY - BOLD FOR DELPHI * VERIFYING THAT THE UPDATE WAS SUCCESSFUL * FILES INSTALLED BY THIS UPDATE =======================================================INSTALLING THIS UPDATE* This update can not be applied to Delphi 7 Architect Trial version. * This update can not be removed after it is installed.* You will need the original Delphi 7 installation CD available to install this update.* To install this update from the CD, insert the CD, and launch the d7_ent_upd1.exe file appropriate for your locale.* To install this update from the Web, double-click the self-executing installation file and follow the prompts. * The Delphi 7 documentation PDF files are available on the update CD.========================================================UPDATING LOCALIZED VERSIONS OF DELPHI 7* This update can be applied only to the English version of Delphi 7. There are separate updates for the German, French and Japanese ver

81,087

社区成员

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

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