If the words in the sql statement conflict with the keywords of mysql, just use `` (above the tab key) to enclose the words. The original sql statement<insert id="insert" parameterType="com.zhangman.manman.entity.User" > insert into user (id, username, password, name, desc, email, birthday, phone, status, createtime, roleId) values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{birthday,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createtime,jdbcType=DATE}, #{roleid,jdbcType=INTEGER}) </insert> Corrected SQL (note that the field and table names are enclosed in ``)<insert id="insert" parameterType="com.zhangman.manman.entity.User" > INSERT INTO `user` (username, `password`, `name`, `desc`, email, birthday, phone, `status`, createtime, roleId) VALUES (#{username}, #{password},#{name}, #{desc},#{email}, #{birthday}, #{phone}, #{status}, #{createtime}, #{roleid}) </insert> Supplement: MySql ERROR 1064 (42000) Same error, different solution The code at the beginning is this: Then run: There is nothing wrong with the code, but why is it wrong? After spending 2 hours on it I finally found the answer. I didn't add the semicolon!!!!! Modified code: Then run again: Once again I feel despair at my own ignorance and carelessness! ! ! The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: HTML table tag tutorial (13): internal border style attributes RULES
>>: Implementation of automatic completion of Docker commands
Table of contents Transaction Isolation Level Pro...
Using the <img> element with the default sr...
Enter net start mysql in cmd and the prompt is: T...
Table of contents 1. rsync, cp copy files 2. sele...
Preface This article mainly introduces the releva...
1. Send effect HTML <div id="send-btn&quo...
Table of contents 1. Introduction 2. Why do we ne...
This article shares with you how to import Excel ...
Let's first look at the definition of the pos...
View the nginx configuration file path Through ng...
Nginx first decides which server{} block in the c...
Since my development environment is to install Ce...
When we are writing a page, we often encounter a ...
Preface In WeChat applet development (native wxml...
principle The principle of anti-shake is: you can...