com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set sex='?”·',set major='è????—???',set classes='111'set tel='123456'' at line 1
错误代号如上,对应的程序代码是:
try {
stmt=conn.createStatement();
StringBuffer sql=new StringBuffer("update student set name='");
sql.append(stu.getName()).append("',set sex='").append(stu.getSex()).append("',set major='").append(stu.getMajor()).append("',set classes='").append(stu.getClasses()).append("'set tel='").append(stu.getTel()).append("'");
stmt.executeUpdate(sql.toString());
} catch (SQLException e) {
e.printStackTrace();
}finally{
try {
stmt.close();
DBUtil.close(conn);
} catch (SQLException e) {
e.printStackTrace();
}
}
这部分到底是哪里出错了呢?还请各位帮帮忙,最后的难关了!
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException错误求助!
答案:1 悬赏:0
解决时间 2021-03-22 19:42
- 提问者网友:℡她的他i☆
- 2021-03-22 01:48
最佳答案
- 二级知识专家网友:爱情是怎么炼成的
- 2021-03-22 03:02
:select * from user where id=1 limit 0,10这种写法是没错的,不过你传的参数错了,你看错误“check the manual that corresponds to your MySQL server version for the right syntax to use near '-5,5' at line 1”你的startno传的是-5这里这个...
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯