G
Guest
Since I can't get answer from the author, can someone address this?
In this article . . .
http://msdn.microsoft.com/msdnmag/issues/04/05/DataPoints/default.aspx
In the "The Transaction and Sequence" paragraph, the author makes this
statement:
"The row is left with different original and current values so that when I
merge the delta DataSet with the originating DataSet, they will sync with
each other properly, using the original values of the OrderID DataColumns. "
Since the author is talking about the insertion of "new" orders where the
Order_ID column is an identity column along with the associated detail
records, the orginal dataset has only current values -- there are no original
values. Added records are merged on the basis of current values.
Here is the code:
DataSet oDsDelta = oOrder.SaveData(oDs.GetChanges());
oOrder = null;
oDs.EnforceConstraints = false;
oDs.Merge(oDsDelta.Tables["Orders"]);
oDs.Merge(oDsDelta.Tables["OrderDetails"]);
oDs.AcceptChanges();
oDs.EnforceConstraints = true;
What is too long to post here is the code that takes oDsDelta and ensures
that its rows have an Original Order_ID value equal to the psuedo key value
assigned by the original dataset and a Current Order_ID value equal to the
database's value. So you can assume the that oDsDeleta has an Original value
and Current value. So a given row in oDs might have -1 as the Current value
but no Original value. The corresponding row in the oDsDelta with have
498576 as the Current Value and -1 as the Original value.
Based on this there is no way to merge these rows. Plus, I believe the rows
have differ row states at this point. What am I missing???
This article has the potential to be very helpful if it only works or if I
can understand it correctly.
In this article . . .
http://msdn.microsoft.com/msdnmag/issues/04/05/DataPoints/default.aspx
In the "The Transaction and Sequence" paragraph, the author makes this
statement:
"The row is left with different original and current values so that when I
merge the delta DataSet with the originating DataSet, they will sync with
each other properly, using the original values of the OrderID DataColumns. "
Since the author is talking about the insertion of "new" orders where the
Order_ID column is an identity column along with the associated detail
records, the orginal dataset has only current values -- there are no original
values. Added records are merged on the basis of current values.
Here is the code:
DataSet oDsDelta = oOrder.SaveData(oDs.GetChanges());
oOrder = null;
oDs.EnforceConstraints = false;
oDs.Merge(oDsDelta.Tables["Orders"]);
oDs.Merge(oDsDelta.Tables["OrderDetails"]);
oDs.AcceptChanges();
oDs.EnforceConstraints = true;
What is too long to post here is the code that takes oDsDelta and ensures
that its rows have an Original Order_ID value equal to the psuedo key value
assigned by the original dataset and a Current Order_ID value equal to the
database's value. So you can assume the that oDsDeleta has an Original value
and Current value. So a given row in oDs might have -1 as the Current value
but no Original value. The corresponding row in the oDsDelta with have
498576 as the Current Value and -1 as the Original value.
Based on this there is no way to merge these rows. Plus, I believe the rows
have differ row states at this point. What am I missing???
This article has the potential to be very helpful if it only works or if I
can understand it correctly.