Solved

updating multiple tables using ADO.NET 2 (VB)

Posted on 2006-11-17
4
144 Views
Last Modified: 2007-12-19
I'm writing an application using ADO.NET 2 and I'm fine getting and updating data from one table, but  I'm confused about updating multiple related tables.

I've got a parent table that has 2 child tables, say a customer table that has two child tables phoneNumbers and deliveryaddresses.

I need to retrieve a customer with a particular id, and all its child tables. These will then be updated in one transaction.


What is the best way to do this?

- do I need one dataadapter per table? (I've tried using only one adapter, but can't get updates to work)

- should I get the tables into one dataset or separate datasets?

(I've got 2 ado.net books and 1 vb.net book and none of them describe this scenario - any suggestions for a good reference book?)

0
Comment
Question by:darrenwright
  • 2
4 Comments
 
LVL 14

Expert Comment

by:jake072
Comment Utility
What database are you trying to modify (SQL, Access ??)

Jake
0
 

Author Comment

by:darrenwright
Comment Utility
SQL 2005

0
 
LVL 6

Accepted Solution

by:
riyazthad earned 250 total points
Comment Utility
- do I need one dataadapter per table? (I've tried using only one adapter, but can't get updates to work)

No You cannot update multiple table with sqlCommandBuilder.

Better approach , I thinik, have mulitple sqlCommnad Object for each update. And fire action query using sqlCommand.ExecuteNonQuery
0
 

Author Comment

by:darrenwright
Comment Utility
I've implemented this by having a separate dataAdapter per table.

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now