Hits 11899 | Created 2007-06-15 | Modified 2007-06-15
This error message had me scratching my head for a few minutes:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert
explicit value for identity column in table 'xxx'
when IDENTITY_INSERT is set to OFF.
The fault in the end was that I had added a primary key and set identity to YES in the database for this table, when in fact I was trying to insert the ID key field myself!
Examine your sql...
Removing both identity and primary key works if you are inserting the key yourself. If you want an auto-generated key, then ensure that identity is turned on and that you have a seed and are auto-incrementing. And also that you aren't adding the primary key yourself!