I have a datatable in which some rows needed to be copied to a new datatable on some condition.My statements are as below.
dt1 = ds1.Tables[0];
DataRow[] dRows = dt1.Select("IS_ALLOWED=" + false);
for (int i = 0; i < dRows.Length; i++)
{
dtPerm.Rows.Add(dRows[i]); //------(1)
//dtPerm.ImportRow(dRows[i]); //------(2)
}
But while debugging from ------(1). It jumps to catch. The exception is
"This row already belongs to another table."
The ----(2) doesn't making any error and the Rows are not adding,But the row is empty and only have a single column.
Is there any solution for this.