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

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 SQL UPDATE 命令语法问题
jayjyy





发贴: 11
积分: 0
于 2006-03-12 21:47 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我用的是ACCESS数据库

sql="UPDATE stuTable SET 姓名 ='"+TName.getText().toString()+"',";
sql=sql+"性别='"+TSex.getText().toString()+"',";
sql=sql+"班级='"+TClass.getText().toString()+"',";
sql=sql+"地址='"+Taddress.getText().toString()+"', ";
sql=sql+"where 学号="+Integer.parseInt(TNum.getText())+"";

运行是出现语法错误,请大家帮帮忙。


{ Please don't use BMP file in the future, I have converted your 169KB file to the following 3KB GIF : }


why edited on 2006-03-12 23:49

作者 Re:SQL UPDATE 命令语法问题 [Re:jayjyy]
zcjl

涅槃



发贴: 537
积分: 65
于 2006-03-12 23:05 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
jayjyy wrote:
我用的是ACCESS数据库

sql="UPDATE stuTable SET 姓名 ='"+TName.getText().toString()+"',";
sql=sql+"性别='"+TSex.getText().toString()+"',";
sql=sql+"班级='"+TClass.getText().toString()+"',";
sql=sql+"地址='"+Taddress.getText().toString()+"', ";
sql=sql+"where 学号="+Integer.parseInt(TNum.getText())+"";

运行是出现语法错误,请大家帮帮忙。


注意被标识出的那一行,where前面不能再有逗号","
ps:Integer.parseInt(TNum.getText())这个类型转换是没有必要的



作者 Re:SQL UPDATE 命令语法问题 [Re:jayjyy]
jayjyy





发贴: 11
积分: 0
于 2006-03-13 22:42 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
谢谢了。我太大意了。



posted on 2006-03-13
sql="UPDATE gradeTable SET ";
sql=sql+"姓名='"+TName.getText().toString()+"',";
sql=sql+"总分="+Integer.parseInt(TSum.getText())+",";
sql=sql+"JAVA="+Integer.parseInt(TJava.getText())+",";
sql=sql+"英语="+Integer.parseInt(TEng.getText())+", ";
sql=sql+"数学="+Integer.parseInt(TMath.getText());
sql=sql+"where 学号="+Integer.parseInt(TNum.getText());

编译没有出错,运行时.保错.语法错误,上次那位高手教了,感觉应该对啊。
真是不明白.
再麻烦你们了。

1不須開新題
2都說不要用bmp檔了!
這是最後一次替閣下轉換(147KB-->3KB),下趟刪帖



why edited on 2006-03-13 23:33

作者 Re:SQL UPDATE 命令语法问题 [Re:jayjyy]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2006-03-13 23:36 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
>54where 學號=6
還不清楚嗎?
這是啥:54where?
遇上問題可以print 整句sql查看

sql=sql+"数学="+Integer.parseInt(TMath.getText()) + " ";
sql=sql+"where 学号="+Integer.parseInt(TNum.getText());



作者 Re:SQL UPDATE 命令语法问题 [Re:jayjyy]
jayjyy





发贴: 11
积分: 0
于 2006-03-14 09:21 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
斑竹,下次我注意了。
谢谢你了。我要学会 了一个调试方法.程序成功了。看来编程得
小心啊,一个空格都要你命啊。
谢谢!




flat 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