curiouswebster
asked on
{"Cannot insert ...when IDENTITY_INSERT is set to OFF."}
Using Entity Framework 4.0 and SQL Server 2008 I got the following exception:
{"Cannot insert explicit value for identity column in table 'notifications' when IDENTITY_INSERT is set to OFF."}
Any idea why?
newbieweb
{"Cannot insert explicit value for identity column in table 'notifications' when IDENTITY_INSERT is set to OFF."}
Any idea why?
newbieweb
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
For the record, where can I find that setting in SQL Server 2008?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
All great advice. Thanks.
It turns out that I have modified the database to have the Indentity set to Yes on the primary ye, but forgot to import it it into the edmx file. Once I imported, it worked.
It turns out that I have modified the database to have the Indentity set to Yes on the primary ye, but forgot to import it it into the edmx file. Once I imported, it worked.
ASKER
Thanks.
ASKER
No, I am letting that value get set by the database.
> You need to set IDENTITY_INSERT to ON for it to be allowed
How do I do that?