日期:2014-05-19  浏览次数:20933 次

INSERT 语句中列的数目大于 VALUES 子句中指定的值的数目。VALUES 子句中值的数目必须与 INSERT 语句中指定的列的数目匹配。
string   cmdtext   =   "insert   into   readerinfo(编号,姓名,系别,性别)   values( "   +   " ' "   +   id   +   " ' "+ " ' "   +   name   +   " ' "   +   " ' "   +   college   +   " ' "   +   " ' "   +   sex   +   " ') ";
这段代码出现如题的错误提示,不知道哪里写错了,麻烦那位高手指点下。

------解决方案--------------------
string cmdtext = "insert into readerinfo(编号,姓名,系别,性别) values( " + " ' " + id + " ', " + " ' " + name + " ', " + " ' " + college + " ', " + " ' " + sex + " ') ";
------解决方案--------------------
string cmdtext = "insert into readerinfo(编号,姓名,系别,性别) values( " ' " + id + " ', ' "+ name + " ', ' " + college + " ', ' " + sex + " ') ";

------解决方案--------------------
SQL insert语句格式:
insert into table_name (column_1, column_2, ...) values ( 'value1 ', 'value2 ',...)

如果值为变量则为( ' "+value1+ " ',....);用逗号分隔