all groups > dotnet datatools > august 2005 >
You're in the

dotnet datatools

group:

how to prevent Datagrid data changes reflecting in the Datatable of the DataSet


how to prevent Datagrid data changes reflecting in the Datatable of the DataSet MZ
8/1/2005 3:32:57 PM
dotnet datatools:
Hi All,

1. I am trying to find a way where on the click of a button say 'Cancel',
the changes on data that have been done in the datagrid are discarded(not
saved to table in the dataset).

2. Is it possible to refresh the Datagridwith the data from the
datatable(same datatable), clearing up the data changes that have been made
to the datagrid. If yes, how

RE: how to prevent Datagrid data changes reflecting in the Datatable Ralph
8/19/2005 6:23:04 PM
The DataTable Class has a method called RejectChanges wich will restore the
DataTable, after that you should refresh the DataGrid, there could be a
better solution to do so, but you could set the DataSource to nothing, and
restore it to the DataTable

[quoted text, click to view]
RE: how to prevent Datagrid data changes reflecting in the Datat PaulNaude
9/8/2005 8:00:01 AM
Or you could simply put the following two lines in your click event:

das1.Clear()
dap1.Fill(das1, "Orders")

where das1 is your dataset and dap1 your data dapter and "Orders" is your
table name. This does not however work if you already updated the database
(i.e. used the

dap1.Update(das1, "Orders")

command.

[quoted text, click to view]
AddThis Social Bookmark Button