Sample code for using DataSet.HasChanges function.
private void UpdateDataSet(DataSet myDataSet)
{
// check for changes with the HasChanges method first.
if (!myDataSet.HasChanges(DataRowState.Modified))
return;
// create temporary DataSet variable.
DataSet tempDataSet;
// getChanges for modified rows only.
tempDataSet = myDataSet.GetChanges(DataRowState.Modified);
// check the DataSet for errors.
if (tempDataSet.HasErrors)
{
// ... insert code to resolve errors here ...
}
// after fixing errors, update db with the DataAdapter used to fill the DataSet.
myDataAdapter.Update(tempDataSet);
}
...S.VinothkumaR.
1 comment:
if (tempDataSet.HasErrors)
{
//Assume there was an error. How do i know which column value data value was wrong?
}
Post a Comment