views:

221

answers:

1

Hi! 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.

+1  A: 

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.

Rob Conery