If the changes have been made to your dataset but not pushed down into the
database yet, you can see the original and new values, as well as
determining what rows are added and deleted, by examining the dataset.
If you are comparing a current dataset against what is already stored in
the database, you are going to have to write your own match/merge routine.
It's unclear to me which way you are going.
If you have a dataset and it has modifications made to it but not saved to
the datasource, this is how you can determine what has been changed:
First, there is a RowState property on each DataRow that is set to
Unchanged, Detached, Added, Modified, or Deleted.
To examine pending changes, you can use the DataRowVersion enumeration. The
ones you are interested in are Current and Original.
I haven't tested this, but I think it will work.
'If you set these before the loop, it doesn't have to
' search for them every time you touch a row;
' this improves performance considerably.
Dim myTable as DataTable = myDataSet("Products")
Dim CompanyNameCol as DataColumn = myTable.Columns("CompanyName")
For each dr as DataRow in myTable.Rows
debug.print("RowState = " & dr.RowState.ToString)
debug.print("DataRowVersion.Current = {0}", _
dr(CompanyNameCol),DataRowVersion.Current))
debug.print("DataRowVersion.Original = {0}", _
dr(CompanyNameCol),DataRowVersion.Original))
Next dr
For more info, check out Dave Sceppa's book, "ADO.Net: Core Reference", or
these links:
http://msdn2.microsoft.com/en-us/library/system.data.datarowview.aspx
http://msdn2.microsoft.com/en-us/library/system.data.dataviewrowstate.aspx
Good luck.
Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------