Parent not present in GetChanges()
-
Hi, I have a problem. Both simple and weird. Say I have ParentTable and ChildTable. Obviously, ChildTable is a child of ParentTable. Both are strongly-typed DataSets. When I create rows for them, I start by creating a ParentTableRow (dataset.ParentTable.AddParentTableRow()), and inserting it into my dataset. Then I create my childTable the same way, and I have to specify the a ParentTableRow, as a reference to its parent. I do it and it looks fine in the debugger (i.e. the ParentTableRow is set). I insert the child row into the dataset too. Then, before committing the changes to the database, I must call GetChanges() on ChildTable, which gives out an array of all rows that have been changed since the loading of the dataset. My new ChildTableRow appears, BUT the ParentTableRow member, (the reference to its parent) is NULL, although it was set earlier! Just before the call to GetChanges() I looked at my ChildTable in the debugger (from dataset.ChildTable) and guess what? The ParentTableRow is still there! It looks like GetChanges() ignores the reference to the ParentTableRow or something... Has anyone any idea of what's going on and how to get though this? Thank you!
-
Hi, I have a problem. Both simple and weird. Say I have ParentTable and ChildTable. Obviously, ChildTable is a child of ParentTable. Both are strongly-typed DataSets. When I create rows for them, I start by creating a ParentTableRow (dataset.ParentTable.AddParentTableRow()), and inserting it into my dataset. Then I create my childTable the same way, and I have to specify the a ParentTableRow, as a reference to its parent. I do it and it looks fine in the debugger (i.e. the ParentTableRow is set). I insert the child row into the dataset too. Then, before committing the changes to the database, I must call GetChanges() on ChildTable, which gives out an array of all rows that have been changed since the loading of the dataset. My new ChildTableRow appears, BUT the ParentTableRow member, (the reference to its parent) is NULL, although it was set earlier! Just before the call to GetChanges() I looked at my ChildTable in the debugger (from dataset.ChildTable) and guess what? The ParentTableRow is still there! It looks like GetChanges() ignores the reference to the ParentTableRow or something... Has anyone any idea of what's going on and how to get though this? Thank you!
why don't you call GetChanges on the whole dataset itself? I think it would solve your problem.
#region signature my articles #endregion
-
why don't you call GetChanges on the whole dataset itself? I think it would solve your problem.
#region signature my articles #endregion
-
Well thanks, it solves my problem, but do you know why it is so? I sincerely feel like I'm missing a piece of the puzzle here. Thank you very much!
No. I don't know why it is so :)
#region signature my articles #endregion