|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
VS2005: Bug in Rowchanged event during cascade update?In a DataSet, I create a ParentTable with a Primary Key (ParentID). I then create a ChildTable with a Primary Key (ChildID) an a ParentID column. I create a Relation from ChildTable.ParentID to ParentTable.ParentID with both Relation and Foreign Key Constraint and Cascade Update rule. I then write at little program: 1. Add a row to the ParentTable (ParentID = 1). 2. Add a row to the ChildTable, referencing the row in the ParentTable. 3. Add RowChanged handlers to both tables. 4. Update ParentID in the parentRow (parentRow.ParentID = 100); - The ParentRow is updated and the update is cascade to the ChildTable. ChildTable.RowChanged is fired. The problem: In the ChildTable.RowChanged handler I can see the childRow has been updated: ((ChildTableRow)e.Row).ParentID is 100. BUT ((ChildTableRow)e.Row).ParentTableRow returns null !!! If I output ds.ParentTable.Rows[0].ParentID (I only have one row in the table) it is 100. The field has been updated in both tables - but ChildTableRow.ParentTableRow cannot find it. If I call ds.ParentTable.FindByParentID(100), null is returned. When the ParentTable.RowChanged event is fired subsequently, there is no problem with ChildTableRow.ParentTableRow. What is going on? Can anybody help me? Regards, Zach |
|||||||||||||||||||||||