Hello,
I'm having trouble adding a DataRow to a DataTable.
I create the DataRow like so:
DataRow row = myDataTable.NewRow();
I add things to the row, then I try to add the row back to the table:
myDataTable.Rows.Add(row);
It tells me: "This row already belongs to this table."
Ironically, if I try:
row.AcceptChanges();
it tells me: "Cannot perform this operation on a row not in the table."
so is it in the table or is it not?
myDataTable.AcceptChanges() seems to run without any exceptions, but my table is still empty.
What gives?
I'm having trouble adding a DataRow to a DataTable.
I create the DataRow like so:
DataRow row = myDataTable.NewRow();
I add things to the row, then I try to add the row back to the table:
myDataTable.Rows.Add(row);
It tells me: "This row already belongs to this table."
Ironically, if I try:
row.AcceptChanges();
it tells me: "Cannot perform this operation on a row not in the table."
so is it in the table or is it not?
myDataTable.AcceptChanges() seems to run without any exceptions, but my table is still empty.
What gives?