0
点赞
收藏
分享

微信扫一扫

idea连接数据库报错java.sql.SQLException: You have an error in your SQL syntax;

梦想家们 2022-04-13 阅读 124

报错:

java.sql.SQLException: 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 ''username',password,email) values('ww','admin','admin@atguigu.com')' at line 1 Query: insert into t_user('username',password,email) values(?,?,?) Parameters: [ww, admin, admin@atguigu.com]

我的错误是在UserDaoImpl包下的实现类saveUser

别在属性名前加引号!!!!!!!!!!!!!!

错误写法:

String sql = "insert into t_user('username','password','email') values(?,?,?)";

正确写法:

String sql = "insert into t_user(username,password,email) values(?,?,?)";
举报

相关推荐

0 条评论