| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 715 人关注过本帖
标题:[求助]SQL抛出一个异常ResultSet is closed怎么解决?
取消只看楼主 加入收藏
sd105252
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2007-8-24
收藏
 问题点数:0 回复次数:1 
[求助]SQL抛出一个异常ResultSet is closed怎么解决?

我写的程序功能对数据库的操作都实现了,不过SQL会抛出一个异常ResultSet is closed,怎么也解决不了。..有人能帮忙下不?

java.sql.SQLException: ResultSet is closed

搜索更多相关主题的帖子: SQL ResultSet closed 
2007-09-02 10:53
sd105252
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2007-8-24
收藏
得分:0 

public void jButton1_actionPerformed(ActionEvent e){

String a = jText1.getText();
String x,y,z;
char [] b;
char [] c;
char [] d;
b = jPasswordText1.getPassword();
c = jPasswordText2.getPassword();
d = jPasswordText3.getPassword();
x = new String(b);
y = new String(c);
z = new String(d);
shujuku shuju2 = new shujuku();

try {
String Str = "SELECT count(*) FROM Login where LoginName = '"+ a +"' AND Password = '"+ x +"'";
String Str2 = "UPDATE Login SET Password = '" + y +
"' WHERE LoginName = '" + a + "'";
ResultSet rs = shuju2.s.executeQuery(Str);

if (y.equals(z) && a.length() > 0 && x.length()>=6 && y.length()>=6 && z.length()>=6)
{
while (rs.next()) {
int f;
f = rs.getInt(1);
if (f < 1) {
JOptionPane.showMessageDialog(this, "用户名或密码不正确\n请重新输入",
"注意",
JOptionPane.PLAIN_MESSAGE, null);
jText1.requestFocus();
jText1.setText(null);
jPasswordText1.setText(null);
jPasswordText2.setText(null);
jPasswordText3.setText(null);
} else {
int rowcount = shuju2.s.executeUpdate(Str2);
if (rowcount == 1) {
JOptionPane.showMessageDialog(this, "修改成功",
"消息",
JOptionPane.INFORMATION_MESSAGE, null);
this.dispose();
}
}
}

}
else {
JOptionPane.showMessageDialog(this,
"1.用户名不能为空\n2.二次输入不一致\n3.旧密码和新密码必须大于6位\n请重新输入",
"注意",
JOptionPane.PLAIN_MESSAGE, null);
jText1.requestFocus();
jText1.setText(null);
jPasswordText1.setText(null);
jPasswordText2.setText(null);
jPasswordText3.setText(null);
}
rs.close();
shuju2.s.close();
shuju2.con.close();

}
catch (SQLException ce) {
System.out.println(ce);
}
//finally{}
}


2007-09-02 11:07
快速回复:[求助]SQL抛出一个异常ResultSet is closed怎么解决?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023971 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved