Select from following answers:- Ensure that the InsertCommand stored procedure returns the generated primary key column value. Update the DataTable row with this value.

- Call DataTable.AcceptChanges after calling the SqlDataAdapter.Update to insert new rows.
- Set the AutoIncrement property to True for the primary key column.
- All Above
You must use the database-generated primary key value to ensure a unique value. Return this to the DataTable upon insertion to keep the table and DataTable values synchronized. This ensures that subsequent updates use the correct primary key value. This is not happening in the scenario.
Setting the AutoIncrement property to True for the primary key column does not solve the synchronization problem.
Show Correct Answer
Source: MeasureUp.Com | |
Alert Moderator