mysql中表的一个字段的字段名和关键字重名 怎么写sql语句

libRA_kin 2010-05-13 01:51:37
INSERT INTO tb_system_help2(sysid,sysname,helpid,helpname,parentid,isLeaf,order) VALUES(?,?,?,?,?,?,?)

那个order字段和关键字重名了 我用 ‘order’ 这样也不行 还有就是插入的数据是汉字时就乱码 可是我的字符集都是统一的utf-8 代码运行时就报这样的错
parentid==>>>>>>SH0
helpname==>>>>>>系统帮助
11>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
33>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
count==>>>>>>>411:59:42,890 ERROR AjaxAction:160 - org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [INSERT INTO tb_system_help2(sysid,sysname,helpid,helpname,parentid,isLeaf,'order') VALUES(?,?,?,?,?,?,?)]; nested exception is 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 ''order') VALUES('greencrossOA','greencross','SH05','????????????','SH0','N','05'' at line 1
11:59:42,890 ERROR AjaxAction:45 - ///////////org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [INSERT INTO tb_system_help2(sysid,sysname,helpid,helpname,parentid,isLeaf,'order') VALUES(?,?,?,?,?,?,?)]; nested exception is 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 ''order') VALUES('greencrossOA','greencross','SH05','????????????','SH0','N','05'' at line 1


插入有汉字的地方就显示一大串问号 这是怎么回事?
...全文
14769 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
加个中括号也行的
蜗牛天堂 2010-09-19
  • 打赏
  • 举报
回复
thank you!!!!!!!111
libRA_kin 2010-05-13
  • 打赏
  • 举报
回复
谢谢!给分
ACMAIN_CHM 2010-05-13
  • 打赏
  • 举报
回复
INSERT INTO tb_system_help2(sysid,sysname,helpid,helpname,parentid,isLeaf,`order`) VALUES(?,?,?,?,?,?,?)


改成 `order` ,注意是数字键1旁边的反引号` 而 不是' 单引号

56,687

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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