Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys may i know what may the cause of this error...
Posted
Comments
Rajendra Koranga 25-Jan-12 3:56am    
sorry ..
error is:-
Insert Error: Column name or number of supplied values does not match table definition.

When you wrote your INSERT statement, you used one of two forms:
SQL
INSERT INTO myTable (Col1, Col2) VALUES('C1', 'C2')

or
SQL
INSERT INTO myTable VALUES ('C1', 'C2')

In the first case, Col1 or Col2 does not exist in myTable, or you have listed two columns and supplied values for three.
In the second, the table does not have two columns.

Use the first version at all times: it guards against changes to the database definition which the second does not.
 
Share this answer
 
Comments
AmitGajjar 25-Jan-12 4:51am    
my 5+
Rajendra Koranga 26-Jan-12 14:41pm    
thanks
OriginalGriff 26-Jan-12 14:52pm    
You're welcome!
[no name] 29-Oct-14 6:58am    
Good one Griff !!
Hi,

can OriginalGriff is right but can you be more specific and post more code?

here you can find more about this error:
http://www.sql-server-helper.com/error-messages/msg-213.aspx[^]

Regards
Robert
 
Share this answer
 
Comments
Rajendra Koranga 26-Jan-12 14:41pm    
thanks
Member 9979723 8-May-13 0:49am    
Thank you so much for this...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900