IDENTITY_INSERT is set to off error

Posted by kingrichard2005 on Stack Overflow See other posts from Stack Overflow or by kingrichard2005
Published on 2010-05-17T18:38:27Z Indexed on 2010/05/17 18:40 UTC
Read the original article Hit count: 274

Filed under:
|
|
|

I have a MVC web application with a table in the model that I would like to add to. I have the primary key set along with the other data fields, but every time I try to add to the table, I get the following error:

"Cannot insert explicit value for identity column in table 'TABLE_NAME' when IDENTITY_INSERT is set to OFF."

I'm not sure why this problem is coming up, I have the primary key set as the identity and it is also set to auto increment in the Visual Studio table designer. Is there any way I can adjust the IDENTITY_INSERT parameter in the table designer in Visual Studio?? Or is there some other issue that might be causing this.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about ASP.NET