Inserting into an identity column fails

  • Thread starter Thread starter Michael Jackson
  • Start date Start date
M

Michael Jackson

Using .NET 2003, 1.1, SQL Server 2000 sp3a, I get the following error when
looping thru a listview and inserting the rows into a sql table with the ID
field as IDENTITY(1,1).

System.Data.ConstraintException: Column 'StoreID' is constrained to be
unique. Value '1' is already present.

However, if I change the column to IDENTITY(10000, 1), I get no error.

Any ideas what's wrong here?
 
You have to set these properties in the dataset field to the following
values:

AutoIncrementSeed = -1
AutoIncrementStep = -1
AutoIncrement = true

Hope that helps.
 
Back
Top