日期:2014-05-16  浏览次数:21404 次

MySQL1136费解错误?!
MySQL表结构是10行,Esclipse连接数据库执行插入语句:
Python code
sql1="""insert into tdxtb_user values('220195','123456','123456','13476123050','1100','测试559','1','2','safeguard','2012-04-09');""";#insert
cur.execute(sql1);

报错:_mysql_exceptions.OperationalError: (1136, "Column count doesn't match value count at row 1")

但问题是在MySQL新建查询输入该SQL语句:
SQL code
insert into tdxtb_user values('220195','123456','123456','13476123050','1100','测试559','1','2','safeguard','2012-04-09')


插入成功,且将原来Esclipse上执行的语句的10个插入数据增加到11个,如下:
SQL code
('220195','123456','123456','13476123050','1100','测试559','1','2','1','safeguard','2012-04-09')
竟执行成功?!

这个就很费解,求大神解答!!不胜感激!!



------解决方案--------------------
sql1中的内容是什么,显示出来看看
------解决方案--------------------
show create table tdxtb_user 看看
------解决方案--------------------
CREATE TABLE `tdxtb_user` (
`User_ID` INT(11) NOT NULL DEFAULT '0' COMMENT '',
`Client_ID` CHAR(12) NOT NULL DEFAULT '' COMMENT '',
`Account` CHAR(12) DEFAULT NULL COMMENT '',
`User_Mobile` BIGINT(11) NOT NULL DEFAULT '0' COMMENT '',
`Branch_ID` INT(5) NOT NULL DEFAULT '0' COMMENT '',
`User_Name` VARCHAR(32) CHARACTER SET utf8 NOT NULL COMMENT '',
`User_Type` TINYINT(3) NOT NULL DEFAULT '0' COMMENT '',
`User_Origin` TINYINT(3) NOT NULL DEFAULT '0' COMMENT '',
`User_Password` VARCHAR(32) CHARACTER SET utf8 DEFAULT NULL COMMENT '' ,
`Modify_Time` DATE NOT NULL DEFAULT '2012-01-01' COMMENT '',
PRIMARY KEY (`User_ID`),
KEY `Client_ID_Branch_ID` (`Client_ID`,`Branch_ID`)
)

SET @sql1="insert into tdxtb_user values('220195','123456','123456','13476123050','1100','测试559','1','2','safeguard','2012-04-09');";
PREPARE stml FROM @sql1;
EXECUTE stml;

测试通过
------解决方案--------------------
打开你的普通查询日志,监视一下你的程序到底传送的是什么SQL语句。