-
January 15th, 2014, 06:47 PM
#1
Can't add DataRow to DataTable
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?
-
January 16th, 2014, 04:18 PM
#2
Re: Can't add DataRow to DataTable
Please share the code that updates the columns within the row with data.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|