Error inserting into an identity column

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

Michael Jackson

My .NET 2003 program uses a dataset bound to a form to insert records into a
SQL Server 2000 table. The key column is IDENTITY(1,1). When I perform a
Dataset.Update, I get an error stating that Value '1' is already in the
table. Turns out that ONLY the first row (ID of 1) of the dataset is
inserted into the table. This happens if I have 2 records in the dataset, or
dozens.

Any ideas?

Michael
 
How are you creating the action Commands? You should not be changing the
identity value in an UPDATE statement or anywhere else. This value is
generated by the server or database engine so you don't have to provide
these values at all.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top