修改操作 出错了 !~ 哪里错了 啊

emailsw 2008-06-23 02:59:13
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 'contryTable_remark='jkkh' where contry_Id=1' at line 1

请问这句话到底是什么意思啊

我是用 Hibernate + struts 修改但是在Hibernate里不能执行自己写的SQL我就用了 JDBC
之后就出现了上边这个错误
String s = "Update contrytable set contry_pronoun=?,contry_name=?,contry_en=?,contry_alphabetic=? contryTable_remark=? where contry_Id="+ ContryId;
请问这条语句哪里出现错误了哦?
高手帮帮忙!~
...全文
148 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhj92lxs 2008-06-23
  • 打赏
  • 举报
回复
Hql......................
emailsw 2008-06-23
  • 打赏
  • 举报
回复
在 Hibernate 里怎么执行自己写的 SQL啊

我 是新手练习中哦
大侠们教教我 被!~
emailsw 2008-06-23
  • 打赏
  • 举报
回复
嘿嘿!~谢谢哦 忘记了

但是新问题又有了 问什么提交之后不Update 呢
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(s);
ps.setString(1, contryPronoun);
ps.setString(2, contryName);
ps.setString(3, contryEn);
ps.setString(4, contryAlphabetic);
ps.setString(5, contryTableRemark);

int i = ps.executeUpdate();
System.out.println(i);
conn.commit();
i的 值是1啊 应该是提交了吧
sheen7758 2008-06-23
  • 打赏
  • 举报
回复
String s = "Update contrytable set contry_pronoun=?,contry_name=?,contry_en=?,contry_alphabetic=? contryTable_remark=? where contry_Id="+ ContryId;


// 第四个问号后面少个逗号.
xuyisun 2008-06-23
  • 打赏
  • 举报
回复
还有Hibernate里是肯定可以执行自己写的SQL的。
xuyisun 2008-06-23
  • 打赏
  • 举报
回复
从你显示的错误上看:
String s = "Update contrytable set contry_pronoun=?,contry_name=?,contry_en=?,contry_alphabetic=? contryTable_remark=? where contry_Id="+ ContryId;


contry_alphabetic=? contryTable_remark=? 这个后面的,号去哪里了呢?
zhj92lxs 2008-06-23
  • 打赏
  • 举报
回复
String s = "Update contrytable set contry_pronoun=?,contry_name=?,contry_en=?,contry_alphabetic=?, contryTable_remark=? where contry_Id="+ ContryId;
zhj92lxs 2008-06-23
  • 打赏
  • 举报
回复
,contry_alphabetic=? contryTable_remark=?
之间少了一个","

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧