I have this code that is supposed to insert the record with identity insert on
using (MCT_DB_ArchiveEntities ent = new MCT_DB_ArchiveEntities())
{
ent.ExecuteStoreCommand("SET IDENTITY_INSERT [clicks] ON");
ent.clicks.Attach(ck);
ent.clicks.Context.ObjectStateManager.ChangeObjectState(ck, System.Data.EntityState.Added);
ent.SaveChanges();
}
I get this error.
Cannot insert explicit value for identity column in table 'clicks' when IDENTITY_INSERT is set to OFF.