Changing primary key value when using DataRelations: BUG Found
We have a Windows Forms application with controls bound to a parent row and a child row. When we change the primary key value in the parent table (at runtime per some user action), we do not see a different child row in the controls bound to the child datarelation . We have cascading updates turned off so the child key values do not get changed.
I worked on this for 8+ hours. I finally gave in and called Microsoft.
The result:
"Initial Analysis: I can reproduce the problem. The problem is with the DataRow.GetChildRows method. It still returns the old child row even after the key value has been changed and AcceptChanges has been called. Deleting and re-adding the DataRelation was the only way I could work around this issue, which should not be necessary. A second issue appeared in that once the GetChildRows method was worked-around, the child CurrencyManager still pointed to the original row and not the new child row. To work around this, I had to replace the Form's BindingContext with a new one. Once this was done, both the CurrencyManager and the controls it managed got updated with values from the correct child row.
<Action Plan>
Neither of these workarounds is acceptable so I am going to file a bug with the development team"
Wonderful, we found yet another bug in the framework.