How can I copy specific rows from DataTable to another Datable.
Solution:
You can use ImportRow method to copy Row from DataTable to DataTable with the same schema
Example:
VB.net
For i As Integer = 0 To dttemp.Rows.Count - 1
DtGetData.Rows.Clear()
DtGetData = dttemp.Clone
Dim dr = dttemp.Rows(i)
DtGetData.ImportRow(dr)
Next
C#
var row = SourceTable.Rows[RowNum];
DestinationTable.ImportRow(row);
0 Comments