Friday, May 4, 2012

Copy selected columns from one DataTable to another with Distinct


DataTable MainDataTable = new DataTable();
...Set values for MainDataTable
//Set First Argument as true if needs as distinct otherwise set false
DataTable ReceiveTable = MainDataTable.DefaultView.ToTable(true, new string[] { "columnName1", "columnName2" });

No comments:

Post a Comment