Solved

updating multiple tables using ADO.NET 2 (VB)

Posted on 2006-11-17
4
149 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 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