how can I copy specific rows from datatable to another datatable in c#? more than on row
+2
A:
foreach (DataRow dr in dataTable1.Rows) {
if (/* some condition */)
dataTable2.Rows.Add(dr.ItemArray);
}
The above example assumes that dataTable1
and dataTable2
have the same number, type and order of columns.
Bradley Smith
2010-10-26 02:36:34
I have to admit your code is better.
Lee Sy En
2010-10-26 02:58:45