November 9, 2007 at 6:55 pm
Dear Forum,
I just moved an asp.net website and SQL 2000 database to another server. I pushed the database accross the internet. It was pretty handy. It all works fine except when I try to edit a record in one of my tables, I get this error. What do you think the problem is?
Thanks
Jeff Wood
Boise, ID
Cannot update identity column 'EventID'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot update identity column 'EventID'.
November 9, 2007 at 9:36 pm
If the column is an identity field, you can't insert a specific value into that field unless you set the identity_insert flag to on for the specific table.
The preferred method is that you NOT insert a specific value, and you let it autoassign the number (that's what an identity field is after all).
If you NEED to however, here is an example. Something along the lines of
SET IDENTITY_INSERT table ON
your insert statement
SET IDENTITY_INSERT table OFF
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply