Reputation: 3279
How do you create DataRow instances that aren't tied to any particular DataTable instance?
(EDIT: I know you can create DataRows using the DataTable.NewRow() method, but the problem is that I can't seem to disconnect the row from its parent table so I can pass the individual row around without having to pass the entire table around)
Upvotes: 2
Views: 456
Reputation: 1500635
One thing you could try is deleting it immediately:
DataRow row = table.NewRow();
row.Delete();
That will put it in a DataRowState
of Detached, which sounds like what you want. I'm not sure what you're trying to achieve in terms of a bigger picture though, so this may not help.
Upvotes: 1
Reputation: 3697
I rather would only copy the content of the DataRow. You can achive that with:
row.ItemArray
I think that would be a better approch, than trying to get a workaround for the lacking copy functionality.
Upvotes: 0