Update dataset back to database

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?
mattphungAsked:
Who is Participating?
 
newyuppieConnect With a Mentor Commented:
maybe try reading these:

http://asp.dotnetheaven.com/howto/doc/adoplus/UpdateDataFromDB.aspx (will show vb code examples of the basics of retrieving to datatset and updating database)

http://www.dbazine.com/sql/sql-articles/cook4 (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: http://msdn2.microsoft.com/en-us/library/system.data.dataset.aspx

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

NY
0
 
newyuppieCommented:
yes sure, you need to use an adapter for that purpose.

MyAdapter.Update(MyDataset)

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

Hope it helps,
NY
0
 
ursangelCommented:
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.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
mattphungAuthor Commented:
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.
0
 
newyuppieCommented:
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.

NY
0
 
mattphungAuthor Commented:
Is there a good tutorial on this?
Thanks for all your help.
0
 
mattphungAuthor Commented:
Thanks for going the extra mile! I really appreciate all your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.