Update dataset back to database

Posted on 2007-12-03
Last Modified: 2010-04-21
If I have a dataset with 3 tables linked by primary and foreign keys can I insert data into the tables and then use the dataset to update the database?
Question by:mattphung
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
  • 3
  • 3
LVL 13

Expert Comment

ID: 20400900
yes sure, you need to use an adapter for that purpose.


The connection string to the database is part of the adapter's properties.

Hope it helps,

Expert Comment

ID: 20400912
Offcourse you can do it.
you need to have a datasource that will be pointing to this dataset.
Update the dataset and then finally when you have done with the updates, just call the
dataset.ApplyUpdates whihc will update your database.

Author Comment

ID: 20430008
Once I update the database with my dataset, will the relationships for each new record be kept? So, the database will assisgn new primary keys to the tables and update all the foreign keys.
Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

LVL 13

Expert Comment

ID: 20430705
I beliebe the database primary keys and the dataset primary keys and relationships are separate. You will need to duplicate them in each, or keep them only in the database.


Author Comment

ID: 20431764
Is there a good tutorial on this?
Thanks for all your help.
LVL 13

Accepted Solution

newyuppie earned 500 total points
ID: 20434169
maybe try reading these: (will show vb code examples of the basics of retrieving to datatset and updating database) (also interesting and shows a bit of foreign key stuff)

but the place to start i guess would always have to be MSDN documentation. try reading this and following the links:

its such a broad subject that its very difficult to direct you to anything in particular. the way i search for stuff is first the MSDN, follow links in there, and for specific things i dont understand there i google them up (for example, google "vb net dataset foreign key"). hope it helps


Author Closing Comment

ID: 31412514
Thanks for going the extra mile! I really appreciate all your help.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL ( and MongoDB (…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

726 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