PDA

Click to See Complete Forum and Search --> : Adding new rows to related tables


ourman
Sep 11th, 2002, 07:05 AM
Hi:

On an VB.Net-SQL 7.0 winform application to be used on a multiuser enviroment I have a dataset with two tables : tblHeader and tblDetails with the following structure:


tblHeader:
-HeaderID
-Name
-Description

tblDetails:
-DetailID
-fHeaderID
-Item
-ItemDescrpiption


There is a parent-child relation between this 2 tables using the primary key of tblHeader (HeaderID) and a foreign key on tblDetails (fHeaderID).

Both tables are not empty, mean they have records and I'll like to keep them.

I will like to add at runtime several new rows to both tables, persist them to the SQL Server 7.0 database and be sure that I keep the relation by using the same value for HeaderID/fHeaderID on each table.

How can I do this?
Thanks in advance,
Erich