Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Servlet/JSP/JSF/JavaFX Script  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 谁能帮我看看,为什么总错啊?(Illegal operation on empty result set)
guoqing_w





发贴: 19
于 2005-04-14 13:06 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
用是的MYSQL数据库
neiro字段是LONGTEXT类型的

<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.io.*" %>
<%
ResultSet result;
String textValue,sql;
try{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
}
catch(java.lang.ClassNotFoundException c){
c.printStackTrace();
}
try{
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/qx?user=root&password=");
String t=request.getParameter("title").trim();
StringBuffer buffer=new java.lang.StringBuffer().append("'").append(t).append("'");
sql="SELECT title,neiro,dtime FROM jtnewtable WHERE title="+t;
result=con.executeQuery(sql);
}
catch(java.sql.SQLException s){
s.printStackTrace();
}
if(result==null){
%>
<p align="center"><font color="#FF0000" size="5"><b>没找到你所选择的新闻!</b></font></p>
<%
}
else{
%>
<p align="center"><font size="5" color="#808080"><%=result.getString("title")%></font></p><hr>
<%
InputStream textStream = result.getAsciiStream( "neiro" );
BufferedReader textReader = new BufferedReader( new InputStreamReader( textStream ) );
textValue = textReader.readLine();
while ( textValue != null )
{
textValue = textReader.readLine();
%>
<p align="center"><font size="2" color="#808080"><%=textValue%></font></p>
<% }
%>
<p align="right"><font size="2" color="#808080">发布时间:<%=result.getString("dtime")%></font></p>
<%
}
%>

错误
symbol : method executeQuery(java.lang.String)
location: interface java.sql.Connection
result=con.executeQuery(sql);

Illegal operation on empty result set 错误


why edited on 2005-04-16 10:47


话题树型展开
人气 标题 作者 字数 发贴时间
1468 谁能帮我看看,为什么总错啊?(Illegal operation on empty result set) guoqing_w 1615 2005-04-14 13:06
956 Re:谁能帮我看看,为什么总错啊???????? wddodo 225 2005-04-16 09:06

reply to postflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923