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

1、错误描写叙述

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

2、错误原因

   
在插入数据时,插入的字段个数跟数据库表字段个数不一致

insert into student(sno,sname,sage,ssex) values(1,‘张三丰‘,‘man‘);

3、解决的方法

   
保证插入数据字段个数跟数据库表中的字段个数一致

insert into student(sno,sname,sage,ssex) values(1,‘张三丰‘,23,‘man‘);

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

时间: 2024-10-21 20:33:07

java.sql.SQLException:Column count doesn't match value count at row 1的相关文章

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

1.错误描述 java.sql.SQLException:Column count doesn't match value count at row 1 2.错误原因     在插入数据时,插入的字段个数跟数据库表字段个数不一致 insert into student(sno,sname,sage,ssex) values(1,'张三丰','man'); 3.解决办法     保证插入数据字段个数跟数据库表中的字段个数一致 insert into student(sno,sname,sage,s

java.sql.SQLException: Column 'class' not found.异常没有找到列

1 /**处理当个对象的 ,rs中要么有一条,要么一条没有. 2 * @param <T> 3 */ 4 public class BeanHandler<T> implements ResultSetHandler<T> { 5 private Class<T> type; 6 public BeanHandler(Class<T> type){ 7 this.type = type; 8 } 9 /**将rs->T t 10 */ 11

resultset 对象获取行字段数据时报:java.sql.SQLException: Column &#39;id&#39; not found.

resultset 对象获取行字段数据时报:java.sql.SQLException: Column 'id' not found. 代码: String sql="SELECT d.content,c.name AS categoryName FROM news_detail d,news_category c WHERE d.categoryId=c.id"; Object[] params ={}; System.out.println(this.executeQuery(sq

ibatis 更改resultmap后 java.sql.SQLException: Column &#39;del_status&#39; not found.

当在resultmap中增加字段后,查询语句也必须增加相应字段,否则会报错, java.sql.SQLException: Column 'del_status' not found. 因为查询结果与resultmap对应不上,ibatis在查询获得结果集中找不到resultmap的对应字段, 我是在resultmap中增加字段,但select语句中并没有增加,折腾了半天 如果属性类型为基本类型而非包装类型,并且数据库中数据为null,那么就会报错 Caused by: java.lang.Ru

Caused by: java.sql.SQLException: Column &#39;show_type&#39; not found

今天在处理个问题的时候遇到了这么个bug,难住了老半天.网上找了挺多资料.这是因为hibernate在别名上的不支持.处理方案是在jdbc数据库连接上计入了这么个配置. 绿色的相当于是个连接符. url="jdbc:mysql://localhost:3306/game_center?useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true" 参考的博文是:http://blog.c

hibernate 出现Caused by: java.sql.SQLException: Column &#39;id&#39; not found.异常

用hibernate进行映射查询时,出现Caused by: java.sql.SQLException: Column 'id' not found 异常,检查数据库表及映射都有id且已经正确映射,google后发现原因为: Your query doesn't return a field named id即查询sql中没有查询出主键id列,但返回结果集中用到,故出现异常特此记录. 详细解答见下: http://stackoverflow.com/questions/34164411/cau

java.sql.SQLException:Column Index out of range,0&lt;1

1.错误描述 2.错误原因 try { Class.forName("com.mysql.jdbc.Driver"); Connection conn = null; Statement stat = null; ResultSet rs = null; try { conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/school", "root", "root

java.sql.SQLException: Incorrect string value: &#39;\xF0\x9F\x9A\x80\xF0\x9F...&#39; for column &#39;name&#39; at row 1

1.异常提示: 12:59:10.000 [http-nio-8080-exec-40] DEBUG o.s.j.s.SQLStateSQLExceptionTranslator - Extracted SQL state class 'HY' from value 'HY000' 12:59:10.000 [http-nio-8080-exec-40] DEBUG org.mybatis.spring.SqlSessionUtils - Closing non transactional Sq

Caused by: java.sql.SQLException: Operand should contain 1 column(s)

1.错误描述 [ERROR:]2015-05-05 15:48:55,847 [异常拦截] org.hibernate.exception.DataException: error executing work at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:135) at org.hibernate.exception.internal.