Reputation: 19
I have an issue with subsonic. I'm trying to insert a record into table with primary key set to identity with autoincrement. I've got an exception:
Cannot insert explicit value for identity column in table 'Zaposleni' when IDENTITY_INSERT is set to OFF.
How do I do this? Please, can anybody provide me an example?
I should mention that I'm using ASP.NET MVC, and SubSonic entities for view model binding.
Upvotes: 1
Views: 546
Reputation:
when IDENTITY_INSERT is set to OFF.
That's your issue. If you've set your identity in your DB, be sure to regenerate - this makes the PK un-writable.
Upvotes: 1