Sorting Datatable or Dataset Rows using LINQ.

vishalneeraj-24503
Posted by vishalneeraj-24503 under LINQ category on | Points: 40 | Views : 602
using System.Linq;
var new_dt = dt_emp.AsEnumerable()
.OrderBy(p => p.Field<int>("emp_id"))
.ThenBy(p => p.Field<DateTime>("modified_date"))
.CopyToDataTable();


Here,dt_emp is a DataTable object and emp_Id,modified_date are Datatable columns

Comments or Responses

Login to post response