G
Guest
Hi,
Using dataadapters, I got the follwing question:
Given a DataSet with two tables (lets call them HEAD and ROW). As you can
imaging, there is a foreign key constraint indicating that every ROW entry
must have a corresponding HEAD entry.
So far so good. Now, I fill a dataset with these two tables. During the
modification, I delete HEAD entries (including their corresponding ROW
entries), and I create new HEAD entries (with subsequent ROW entries).
The problem arises when trying to update the database:
With this code:
ds.Update(dataAdapterHEAD)
ds.Update(dataAdapterROW)
....fails because during the update, I cannot delete HEAD table entries as
long as there are still corresponding ROW entries.
ds.Update(dataAdapterROW)
ds.Update(dataAdapterHEAD)
....fails because I cannot create ROW table entries as long as there is no
corresponding HEAD entry.
Which way to most easily overcome this? Is there a way to limit the Update
command to only execute either INSERT; DELETE or UPDATE?
Thanks for the enlightning!
Sincerely
Joerg Fischer
Using dataadapters, I got the follwing question:
Given a DataSet with two tables (lets call them HEAD and ROW). As you can
imaging, there is a foreign key constraint indicating that every ROW entry
must have a corresponding HEAD entry.
So far so good. Now, I fill a dataset with these two tables. During the
modification, I delete HEAD entries (including their corresponding ROW
entries), and I create new HEAD entries (with subsequent ROW entries).
The problem arises when trying to update the database:
With this code:
ds.Update(dataAdapterHEAD)
ds.Update(dataAdapterROW)
....fails because during the update, I cannot delete HEAD table entries as
long as there are still corresponding ROW entries.
ds.Update(dataAdapterROW)
ds.Update(dataAdapterHEAD)
....fails because I cannot create ROW table entries as long as there is no
corresponding HEAD entry.
Which way to most easily overcome this? Is there a way to limit the Update
command to only execute either INSERT; DELETE or UPDATE?
Thanks for the enlightning!
Sincerely
Joerg Fischer