You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘release
(expo_id,exhibitor_id,user_id,
contact_phone,contact_pe’ at line 1
insert into release
(expo_id,exhibitor_id,user_id,
contact_phone,contact_person,
company,content,`type`,create_time)
values (#{expoId,jdbcType=INTEGER},#{exhibitorId,jdbcType=INTEGER}
,#{userId,jdbcType=INTEGER},#{contactPhone,jdbcType=VARCHAR},#{contactPerson,jdbcType=VARCHAR}
,#{company,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR}
,#{createTime,jdbcType=TIMESTAMP})
改为
insert into `release`
(expo_id,exhibitor_id,user_id,
contact_phone,contact_person,
company,content,`type`,create_time)
values (#{expoId,jdbcType=INTEGER},#{exhibitorId,jdbcType=INTEGER}
,#{userId,jdbcType=INTEGER},#{contactPhone,jdbcType=VARCHAR},#{contactPerson,jdbcType=VARCHAR}
,#{company,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{type,jdbcType=VARCHAR}
,#{createTime,jdbcType=TIMESTAMP})
修改的地方
把release改为`release`
总结
数据库出现You have an error in your SQL syntax+server version for the right 这几个关键字可能就是mysql关键字报错,给相关字段加上`符号即可
本文讨论了在SQL插入操作中遇到的错误提示'You have an error in your SQL syntax',并提供了解决方案。关键在于识别MySQL中的关键字冲突,并通过在字段名前加反引号`来解决。修复后的SQL语句成功插入了数据。

8218

被折叠的 条评论
为什么被折叠?



