Cause: java.sql.SQLException: Column count doesn‘t match value count at row 1

Cause: java.sql.SQLException: Column count doesn‘t match value count at row 1,第1张

Cause: java.sql.SQLException: Column count doesn‘t match value count at row 1

2021-12-15 15:29:50.983 ERROR 5340 --- [nio-8081-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: 
### Error updating database.  Cause: java.sql.SQLException: Column count doesn't match value count at row 1
### The error may exist in file [E:demotargetclassesmapperStudentMapper.xml]
### The error may involve com.example.stu.demo.tao.StudentMapper.addStudent-Inline
### The error occurred while setting parameters
### SQL: insert into student values (?,?,?,?)
### Cause: java.sql.SQLException: Column count doesn't match value count at row 1
; bad SQL grammar []; nested exception is java.sql.SQLException: Column count doesn't match value count at row 1] with root cause

 图一是实体类中包含的属性,图二是数据库student表中的字段

由于数据库student表中多了一个"psw"字段,会出现Column count doesn't match value count at row 1错误

解决办法:把“psw"字段删除

 

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5672057.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存