I hve came across an issue today:
I wanted to copy some datarows from one table to another.
I tried first to do this:
foreach(DataSetSource.Row row in tableSource)
{
tableDestination.Add Row(row);
}
It compiled with no errors but at run time threw exception saying “row already belongs to another table”
So I found some other way to do it :
foreach(DataSetSource.Row row in tableSource)
{
tableDestination.Rows.Add(row.ItemArray);
}
and this way it worked just fine.
Leave a Reply