tags:

views:

51

answers:

2

I want to add a new column to my dataset without affecting the underlying database. That new column will be updated from my WinForm. How to do changes (add column, do updates, etc) on a dataset without affecting the database?

+1  A: 

As long as your dataset is not directly linked to your DB via a dataadapter or datasource, you should be able to perform any operations on the dataset (or a datatable) and then only commit the changes when you wish with the aforementioned dataadapters or datasources.

TheTXI
+3  A: 

They don't affect the underlying data source at all. The DataSet is an in-memory representation of the data that you queried from the underlying data source. Any changes to the data in the data set are not persisted back to the database until you pass it to a data adapter to update the data.

The data adapter cannot change the structure given changes to the structure of the dataset (more or less columns, types of columns, etc, etc), so you don't have to be worried about changes to the structure, unless you are changing the names of columns or the types, in which case, the data adapter might have trouble mapping the data back to the data source.

casperOne