Parent-Child Table Updation Problem

Jan 7 2006 7:50 AM
Hi!

Note: I'm not using  Typed Datasets.

I've window form from which:

I'm adding new departments to department (DID,Department) table and

then adding new employees to employee (EID,Name,DID) table. These tables are related by column "DID" and are filled into one main data set.

on form I create new departments and add new employees to both older/newly added departments.

I'm using two data adapters, one for employee and other for department and both have been configured to do the four DML operations i.e "CRUD".

When I add only employees or only departments and save them, it works fine. But

1) When I add new departments to the department table and then add employees to the employee table for newly added departments, both primary keys (which are also identities in respective tables) gets incremented by -1.

When I try to update them I get Integrity violation error. Which I think is becuase of the dummy values I'm using doesn't reflect the original values. Is there any easy solution for this problem rather than checking each newly added row in Department table and then for that row checking each newly added employee row.

Note: I hope I've explained the problem clearly if not please let me know I'll modify it and try to simplify even more.

Any help/guidance would be appreciated.

regards.