can't find childrows....
-
Hi Don't know what's wrong with my code(below), it runs but doesn't return any childrows( however exists -childrows.length=0- & identified by parent rows ID). Dataset was created by wizard, table & nested table in the dataset browser exist. I don't have any idea left... Thanks for your posts in advance, g
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (Validate() && uzemanyagBindingSource != null) { bool deleteRow = true; DataRowView rowView = uzemanyagBindingSource.Current as DataRowView; if (rowView == null) { return; } Debmut9DataSet.UzemanyagRow row = rowView.Row as Debmut9DataSet.UzemanyagRow; Debmut9DataSet.GepRow[] ChildRows = row.GetGepRows(); if (ChildRows.Length > 0) { DialogResult userChoice = MessageBox.Show("All records in this & realted table will be deleted.Continue?", "Delete...", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (userChoice == DialogResult.Yes) { foreach (Debmut9DataSet.GepRow childuzemanyag in ChildRows) { childuzemanyag.Delete(); } } else { deleteRow = false; } } if (deleteRow) uzemanyagBindingSource.RemoveCurrent(); uzemanyagBindingSource.EndEdit(); Array.Resize(ref uzemanyagregiar, uzemanyagBindingSource.List.Count); }
-
Hi Don't know what's wrong with my code(below), it runs but doesn't return any childrows( however exists -childrows.length=0- & identified by parent rows ID). Dataset was created by wizard, table & nested table in the dataset browser exist. I don't have any idea left... Thanks for your posts in advance, g
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (Validate() && uzemanyagBindingSource != null) { bool deleteRow = true; DataRowView rowView = uzemanyagBindingSource.Current as DataRowView; if (rowView == null) { return; } Debmut9DataSet.UzemanyagRow row = rowView.Row as Debmut9DataSet.UzemanyagRow; Debmut9DataSet.GepRow[] ChildRows = row.GetGepRows(); if (ChildRows.Length > 0) { DialogResult userChoice = MessageBox.Show("All records in this & realted table will be deleted.Continue?", "Delete...", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (userChoice == DialogResult.Yes) { foreach (Debmut9DataSet.GepRow childuzemanyag in ChildRows) { childuzemanyag.Delete(); } } else { deleteRow = false; } } if (deleteRow) uzemanyagBindingSource.RemoveCurrent(); uzemanyagBindingSource.EndEdit(); Array.Resize(ref uzemanyagregiar, uzemanyagBindingSource.List.Count); }
Think I got it I forgot to fill the child table, upon the load event of the form whose control is bound to parent table. so the classic: childtableadapter.fill (dataset.childtable)