DataTable NOT to assign Primary Key
-
Hi, I have a Typed DataTable created by the DataSet Designer with a Primary Key (let's say ID). I've setup SQL Server to set the ID field to auto insert if no value is supplied. The problem is that the DataTable has set the IDColumn.Unique = True and the IDColumn.AllowDBNull = False, so when i insert new rows into the DataTable, the DataTable will assign unique keys to the ID column but the assigned id might already be in the database, so when i update the DataTable it fails. When i try to set the Unique Property of the ID field to false (so i can set all ID fields to NULL and the db will fill them) Visual Studio will complain that its a primary key field which needs to be unique. So basically i want to be able to insert into a DataTable 1000 new rows and the db should assign their PrimaryKey and not the DataTable. Thanks in advanced