This Row already belongs to another table error when trying to add rows?

后端 未结 7 1518
闹比i
闹比i 2020-11-28 02:58

I have a DataTable which has some rows and I am using the select to filter the rows to get a collection of DataRows which I then loop through using foreach and add it to ano

7条回答
  •  春和景丽
    2020-11-28 03:28

    yourTable.ImportRow(dataRow);
    

    It's because the row you're copying doesn't have the same TableName:

    For example, try:

    Table1.TableName = "Table1";
    Table2.TableName = "Table2";
    

提交回复
热议问题