Dear Friends,
I Have two DataTables, dt1 and dt2. I Want to add
a Row From dt1 to dt2 this is my code:
Even when RowState shows that dRow is detached,
when the line dt2.Rows.Add(dRow) is executed i get
an error which says: "This row already belongs to another table"
can somebody tell me why?? or how can i add a DataRow
from one DataTable to another???can i make a copy from
a DataRow???
Thanks For any help
I Have two DataTables, dt1 and dt2. I Want to add
a Row From dt1 to dt2 this is my code:
Code:
Dim dRow As DataRow
dRow = dt1.Rows(IndexOfTargetRow)
dRow.Delete()
dRow.AcceptChanges()
'Or instead of two lines above: dt1.Rows.Remove(dRow)
If dRow.RowState = DataRowState.Detached Then
dt2.Rows.Add(dRow)
end if
Even when RowState shows that dRow is detached,
when the line dt2.Rows.Add(dRow) is executed i get
an error which says: "This row already belongs to another table"
can somebody tell me why?? or how can i add a DataRow
from one DataTable to another???can i make a copy from
a DataRow???
Thanks For any help