Question Update records in datatable during walk through

Bernie

Well-known member
Joined
Aug 13, 2007
Messages
98
Programming Experience
3-5
I have an unbound DataSet with a table that needs to have every record updated. Can I do something like this;

For Each myRow in myTable.Rows
myRow("myField") = "foo"
End For Each
myTable.AcceptChanges

or do I need to AcceptChanges on each row?

Thanks,
Bernie
 
Calling AcceptChanges on a DataTable will implicitly call AcceptChanges on every DataRow. Likewise, calling AcceptChanges on a DataSet will implicitly call AcceptChanges on every DataTable.

You do know that calling AcceptChanges means that those changes can never be saved to a database, right?
 
"You do know that calling AcceptChanges means that those changes can never be saved to a database, right?"

Yes, but in this application the dataset is unbound from the database and the field that needs to be updated doesn't exist in the database. That's why I need to fill them in before printing the report.

Thanks for the help! I think I'll call accept once if only for a nood towards more efficiency, hahahaha.

Bernie
 
Back
Top