C
c4p
Hello to all.
I have simple form with DataGrid binded to DataTable.
DataTable has foreign key to itself.
When I'm deleting one row it's child rows stay in Table.
(It deletes only parent row, not child).
Here is code:
DataTable TestTable = new DataTable("Test");
TestTable.Columns.Add("ID", typeof(Int32));
TestTable.Columns.Add("ParentID", typeof(Int32));
TestTable.Constraints.Add("PARENT_TO_ID",
TestTable.Columns["ID"],
TestTable.Columns["ParentID"]);
DataRow TestRow = TestTable.NewRow();
TestRow["ID"] = 1;
TestRow["ParentID"] = DBNull.Value;
TestTable.Rows.Add(TestRow);
TestRow = TestTable.NewRow();
TestRow["ID"] = 2;
TestRow["ParentID"] = 1;
TestTable.Rows.Add(TestRow);
dataGrid1.DataSource = TestTable;
Is it DataTable bug?
Thanks in advance!
I have simple form with DataGrid binded to DataTable.
DataTable has foreign key to itself.
When I'm deleting one row it's child rows stay in Table.
(It deletes only parent row, not child).
Here is code:
DataTable TestTable = new DataTable("Test");
TestTable.Columns.Add("ID", typeof(Int32));
TestTable.Columns.Add("ParentID", typeof(Int32));
TestTable.Constraints.Add("PARENT_TO_ID",
TestTable.Columns["ID"],
TestTable.Columns["ParentID"]);
DataRow TestRow = TestTable.NewRow();
TestRow["ID"] = 1;
TestRow["ParentID"] = DBNull.Value;
TestTable.Rows.Add(TestRow);
TestRow = TestTable.NewRow();
TestRow["ID"] = 2;
TestRow["ParentID"] = 1;
TestTable.Rows.Add(TestRow);
dataGrid1.DataSource = TestTable;
Is it DataTable bug?
Thanks in advance!