Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dataset updates with child table

Status
Not open for further replies.

Zarcom

Programmer
May 7, 2002
1,275
CA
I seem to have ran into a rather solid wall here. Or perhaps I have simply lost my capability to think logically. In anycase I hope some of you can help me.

I have a dataset defined with a simple parent child relationship between two tables.
Parent table is a table of Listings.
Child table is a table of phone numbers. Each row in the child table is linked to the parent by the parents ID number. This number is an autonumber in the database.

So I have a page that allows an administrator to add new listings with numbers into the database. Since I don't at the time know the autonumber that the database will assign to the new listing I enter a temp number. I also use that temp number to link the phone numbers in the child table.

The problem occurs when I use the update command of a dataAdapter to persist the changes to the dataset into the database. The parent table is updated but I know have no way of knowing which row in the child table belongs to the row in the parent table since my temporary ID has changed. I know I can do this by skipping the dataAdapter and adding a single row at a time from the parent returning the @@Identity parameter. But I wished to try to find a way to do this with multiple new rows in the parent table aka using the Adapter.

Sorry for my rather long winded question. Hope someone out there has an idea.

That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top