I have a scenario where-in I have a DataTable with certain columns “Col1, Col2, Col3”. I want to copy just “Col2, Col3” into another DataTable which has a primary key “ID”. What is the best way to copy them. There are 5000+ records and performance is a key factor.
I tried with Select, DefaultView.RowsFilter but no success. I know one option is to loop through all records an copy data one by one in second DataTable. But wanted to know a better way.
try this code (visual basic):
If you want distinct rows then put true in first
ToTableargument.