We have a dataset with one thousand records. Now we bind it to a datagrid. Now the question is suppose we have modified only three records in datagrid then how to update these three records in dataset. We have a single button to update the records
RE: We have a dataset with one thousand records. Now we bind it to a datagrid. Now the question is suppose we have modified only three records in datagrid then how to update these three records in dataset. We have a single button to update the records
Use the RowState property of the DataTable in the DataSet that the grid is bound to where RowState is Modified. You can do this in a number of ways if you do a Select on the DataTable you can pass RowState as one of the parameters of the overloaded Select methods this will return an array of Row Objects of only the modified rows.
foreach(DataRow ModifiedRow in _MyDT.Select(string.Empty string.Empty DataViewRowState.Added)) { Do update here... }