求助:关于java.sql.SQLException: Operation not allowed after ResultSet closed的问题
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.sql.*,java.util.*,com.info.bean.*,com.info.inc.*"%>
<%@ include file="islogin.jsp"%>
<%@ include file="isadmin.jsp"%>
<%
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
PreparedStatement ps2 = null;
ResultSet rs2 = null;
conn=dbconn.getconnection();
comm commhtml = new comm();
String htmlhead ="";
htmlhead = commhtml.HtmlHead("友情提示");
out.println(htmlhead);
%>
<meta http-equiv=refresh content="600;URL=infolist.jsp">
<table align=center width='80%' border=0>
<tr><td>
<div align=left>
<B>回复信息提示</B>:(点击信息标题可以直接进入)
<br>
<%
String StrSql;
StrSql="select * from info_info where guidang=0 and recontent!='' and recontent is not null and isback=0";
StrSql= StrSql + " order by updatetime desc,dateyear desc,yearid desc limit 0,20";
//ps = conn.prepareStatement(StrSql);
ps= conn.prepareStatement(StrSql);
rs = ps.executeQuery();
while (rs.next())
{
%>
<FONT COLOR="#CC0033"><B><%=rs.getString("AdminUnit")%></B></FONT> 对 <a href="recontent.jsp?id=<%=rs.getString("Info_Id")%>"><FONT COLOR="#3333FF"><%=rs.getString("Info_Title")%></FONT></a> 信息做了回复 (<%=rs.getString("Info_Time").substring(0,10)%>)。<br>
<%
}
String StrSql2;
StrSql2="select * from info_info where isback=1 order by updatetime desc,dateyear desc,yearid desc limit 0,20 ";
//ps2 = conn.prepareStatement(StrSql2);
ps2 =conn.prepareStatement(StrSql2);
rs2 = ps2.executeQuery();
int r=0;
%>
<br><br>
<B>退回信息提示</B>:(点击信息标题可以直接进入)
<br>
<%
while (rs2.next())
{
r=1;
%>
<a href="recontent.jsp?id=<%=rs2.getString(1)%>"><FONT COLOR="#3333FF"><%=rs2.getString(9)%></FONT></a> 信息被退回 (<%=rs2.getString(11).substring(0,10)%>)。<br>
<%
}
if(r==1)
{
%>
<EMBED src="/nudge.wav" autostart="true" loop="false" width="0" height="0" hidden=true >
<%
}
%>
</td></tr></table>
</div>
<%
rs2.close();
rs2=null;
ps2.close();
ps2=null;
rs.close();
rs=null;
ps.close();
ps=null;
dbconn.closeconnection();
conn=null;
out.println(commhtml.HtmlTail());
commhtml=null;
目前的问题是,我是读取了两遍数据库,也是使用两个PreparedStatement 和两个ResultSet 来做的,但是它有时候就好使,没有问题,有时候刷新的话 就会出现java.sql.SQLException: Operation not allowed after ResultSet closed的错误,改了好多遍,都不知道错误在哪里,哪位大哥知道啊。愁死了!
十万分感谢啊!
相关推荐
java.sql.SQLException: 结果集已耗尽
NULL 博文链接:https://listen-raining.iteye.com/blog/1962065
java.sql.SQLException: null, message from server: “Host ‘%’ is not allowed to connect to
在阿里云 SUSE linux配置完mysql后,服务器端本身是可以访问数据库的如图: 但是在客户端不可以,服务启动时报错: java.sql.SQLException: null, message from server: “Host ‘223.72.41.7’ is not allowed to connect to this MySQL server” 客户端访问时报错: 解决方法: 1,登陆服务器 mysql> use mysql; //用mysql database 2,查询user表如下: 3,mysql> update user set host=’%’ where u
java中ResultSet遍历数据操作
主要介绍了java中ResultSet遍历数据操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
解决IDEA错误 Cause: java.sql.SQLException: The server time zone value的问题
主要介绍了解决IDEA错误 Cause: java.sql.SQLException: The server time zone value的问题,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
JAVA 版本ResultSet 转换为JAVABEAN的工具类
JAVA 版本ResultSet 转换为JAVABEAN的工具类


Web 开发
