Solved

updating multiple tables using ADO.NET 2 (VB)

Posted on 2006-11-17
4
147 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
ID: 17965460
What database are you trying to modify (SQL, Access ??)

Jake
0
 

Author Comment

by:darrenwright
ID: 17965554
SQL 2005

0
 
LVL 6

Accepted Solution

by:
riyazthad earned 250 total points
ID: 17966140
- 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
ID: 18052469
I've implemented this by having a separate dataAdapter per table.

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

829 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