Solved

update datatable when rows are deleted in the database

Posted on 2015-01-08
2
23 Views
Last Modified: 2016-06-23
I fill a datatable from information from a database via a dataadapter.  I have no issues in updating my database from changes in the datatable or updating the datatable from changes in the main database via my dataadapter.

My problem is when I have a deleted row in the main database.  I then call a dataadapter.fill and the rows are updated but the deleted row still exists in the datatable.

Is there a quick way to do a .fill and have it delete the rows in the datatable that were deleted in the main database or at least mark them as deleted?
0
Comment
Question by:hotshottools
2 Comments
 
LVL 33

Accepted Solution

by:
Mike Eghtebas earned 500 total points
ID: 40538977
try:

YourDataSet.Reset()
YourTableAdapter.Fill(YourDataSet.table)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

895 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