I have an Expression based DataColumn that is defined to calculate the Qty
sum of all child rows, based on a self-referencing relationship (i.e.
Parent.aggregateQty = sum(Child(linkedRelationship).Qty) where both Parent
and Children are entries to the same DataTable.
I'm finding that if I create a new Child row and link it to a pre-existing
Parent, the next time I trigger an update event on that Parent row I get a
Error:
"An unhandled exception of type 'System.Data.VersionNotFoundException'
occurred.
Additional information: There is no Original data to access."
It appears that if the Parent rowState != 'Added', then it expects to find
an Original version value in each linked Child, throwing an exception when it
encounters the 'Added' child.
I can avoid the error by adding the child with a LoadDataRow command,
passing AcceptChanges = 'true', as this creates the row in an 'unmodified'
state. But this messes up the data update logic later on which relies on the
'added' state to call the correct stored procedure.
Any suggestions?