| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 513 人关注过本帖
标题:[求助]SQL更新问题!
只看楼主 加入收藏
skylence
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2006-11-15
收藏
 问题点数:0 回复次数:2 
[求助]SQL更新问题!

try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:教务";
Connection con=DriverManager.getConnection(url);
Statement useset=con.createStatement();

String sql="update student set name='"
+jt[1].getText()+"'"+" and classnumber='"
+jt[2].getText()+"'"+" and sex='"
+jt[3].getText()+"'"+" and grade='"
+jt[4].getText()+"'"+" and zznum='"
+jt[5].getText()+"'"+" and peoplenum='"
+jt[6].getText()+"'"+" and bornnum='"
+jt[7].getText()+"'"+" and id='"
+jt[8].getText()+"'"+" and studynum='"
+jt[9].getText()+"'"+" and psw='"
+jt[10].getText()+"'"+" where number='"+jt[0].getText()+"'";

useset.executeUpdate(sql);
JOptionPane.showMessageDialog(null,"更新成功!");
jf.setVisible(false);
useset.close();
con.close();
}
catch(Exception ie)
{
ie.printStackTrace();
JOptionPane.showMessageDialog(null,"更新失败!","提示!",JOptionPane.ERROR_MESSAGE);
System.out.print("连接数据库失败!");
}
}
大家给我看看吧 为什么就是不能更新呢 jt[i].getText()表示我要输入更新的内容!

搜索更多相关主题的帖子: SQL 
2007-07-31 12:17
purana
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:广东-广州
等 级:版主
威 望:66
帖 子:6039
专家分:0
注 册:2005-6-17
收藏
得分:0 
有什么错误发生吗?
还是你的number是数值类型..要转换一下?.

我的msn: myfend@
2007-07-31 12:44
skylence
Rank: 1
等 级:新手上路
帖 子:92
专家分:0
注 册:2006-11-15
收藏
得分:0 
呵呵 解决了 谢谢啊
符号弄错拉

2007-08-03 20:34
快速回复:[求助]SQL更新问题!
数据加载中...
 
   



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

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