c# - How do I copy a DataColumn from DataTable1 into DataTable2? -
i copy datacolumn
datatable
datatable
, don't know how do...
datacolumn[] dc = new datacolumn[datatable1.columns.count]; datatable1.columns.copyto(dc, 0); datatable2.columns.add(dc[index]);
error
datacolumn belongs datatable!
you use dataview.totable method accepts column names want have in new table.
datatable datatable2 = datatable1.defaultview.totable(false, new string[] {"customername"});
keep in mind creates new datatable original table column specified in string array (of course original table should have column named "customername")
Comments
Post a Comment