PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Error inserting into an identity column
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Error inserting into an identity column
![]() |
Error inserting into an identity column |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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. __________________________________ "Michael Jackson" <michaeldjackson@cox.net> wrote in message news:g9bhe.35082$fx3.20924@okepread02... > 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 > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

