This is the fundamental shortcoming with the DataAdapter. It was designed to
deal with a pretty simple case and only one table. Handling more complex
updates is beyond it's (basic) functionality as you have discovered. I
suggest writing a SP that handles all three operations in a transaction.
Yes, you can intercept the Update events and fire off your own
UPDATE/INSERT/DELETE operations. You might also consider something
else--replication. This is easier than ever with the Local Data Cache
approach.
--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
"TJ" <(E-Mail Removed)> wrote in message
news:3BE6E1F2-68CF-4D51-A927-(E-Mail Removed)...
> Hi.
>
> I have a dataset that contains 3 tables.
> Records have been added into each tables.
> For example,
>
> A table - 3 records added (RowState - Added)
> B table - 2 records added (RowState - Added)
> C table - 4 records added (RowState - Added)
>
> I would like to add these records back to the database by using
> DataAdapter..::.Update method..
> However, it seems that it only supports one table at a time.
> Am I correct?
>
> If this only can be done by one one Update method calling,
> how am I supposed to create a InsertCommand query?
> Like "Insert into A(...); Insert into B(...);...Insert into C(..);"???
>
> Or should I call the Update three times for each table?
>
> Thanks,
>
|