ANAT2403
asked on
update datatable in a dataset in ADO.NET 2.0
I have an application in VS2005 winforms C#.
I have a dataset with a datatable. I updated some records in the datatable. (not add just update)
I want to create a collection of these changed records . I would also like to see some examples on this issue.
Thankyou
Anat
I have a dataset with a datatable. I updated some records in the datatable. (not add just update)
I want to create a collection of these changed records . I would also like to see some examples on this issue.
Thankyou
Anat
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
It doesnot work.
I have a dataset and a datatable dt1.
I create a new datatable dt2 : dt2 = new dt1();
I edit and change a record in dt2.
The command myDataSet.HasChanges(DataR owState.Mo dified) return false.
Hoe do I do it?
It doesnot work.
I have a dataset and a datatable dt1.
I create a new datatable dt2 : dt2 = new dt1();
I edit and change a record in dt2.
The command myDataSet.HasChanges(DataR
Hoe do I do it?
>I edit and change a record in dt2.
how?
how?
ASKER
this is how:
DataRow dr;
dr = dt2.Rows.Find(keyIDStr);
dr.BeginEdit();
dr["ManufacturerID"] = ChangedValue;
dr.EndEdit();
Anat
DataRow dr;
dr = dt2.Rows.Find(keyIDStr);
dr.BeginEdit();
dr["ManufacturerID"] = ChangedValue;
dr.EndEdit();
Anat
>The command myDataSet.HasChanges(DataR owState.Mo dified) return false.
actually, the method HasChanges returns a DataSet, and not a boolean?!
actually, the method HasChanges returns a DataSet, and not a boolean?!
ASKER
I am looking for command on a datatable or a view about the changes. not command on the dataset.
Anat
Anat
Try this....
private void UpdateDataSet(DataSet myDataSet){
if(!myDataSet.HasChanges(D
return;
DataSet xDataSet;
//To get modified row only
xDataSet = myDataSet.GetChanges(DataR
if(xDataSet.HasErrors){
// Insert code to resolve errors.
}
myOleDbDataAdapter.Update(
}