Updating data in a dataset

Rated 4.13/5 based on 907 customer reviews

This wouldn't be a problem if you were only updating 1 table but when you have child tables that need the same value you will run into issues. Here is where you add the event handler Parent Adapter. are used for controlling Datasets and it provides communication between Data Sets and Data Source.

updating data in a dataset-10

updating data in a dataset-26

As you can see from listing 5-48, I created a filled Data Set and created a new Data Row using the Data Table. After creating a Data Row, I set its column values and called the Data Adapter's Update method and displayed data in the Data Grid.

One of the things I have noticed about working with Data Sets is that there is not a lot of information out there on how to work with Foreign Key constraints and merging 2 databases together. That way you have 2 identical Data Sets when you go to merge them together and you can reuse all the same code again. Just repeat the steps above for multiple tables and multiple databases and you can merge as many databases and tables as you need to.

Let me rephrase that, there is a but it feels scattered about and I felt it didn't teach me what I needed to know. You don't have to do this if you don't want to as there are ways around it by using Missing Schema Action but I prefer to have identical Data Sets to work from.

Using the Data Adapters you can fill Data Set and use this dataset for retrieving and storing information.

When all the tasks get completed, update Real Database with datasets.

Leave a Reply