PC Review


Reply
Thread Tools Rate Thread

DataAdapter.Update

 
 
TJ
Guest
Posts: n/a
 
      28th Oct 2008
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,

 
Reply With Quote
 
 
 
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      29th Oct 2008
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,
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dataadapter.Update() multiple table update strategies jarb Microsoft ADO .NET 3 2nd Nov 2006 08:57 AM
DataAdapter.Update A.M-SG Microsoft ADO .NET 1 19th Jan 2006 02:16 AM
How best to update DataAdapter to make DataGrid update immediately like table in Access would John Edens Microsoft Dot NET Framework Forms 1 5th Aug 2005 07:44 AM
DataAdapter.Update Command Failed To Update Database Chris Lee Microsoft ADO .NET 10 4th Aug 2004 06:53 PM
DataAdapter update Ruslan Shlain Microsoft VB .NET 1 5th Feb 2004 08:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:30 AM.