Reylin Mathew

Reylin Mathew

  • NA
  • 347
  • 75.6k

how to convert linq list to datatable

Jun 19 2019 3:49 AM
this is my code
 
ataTable dt = new DataTable();
dt = ds.Tables[0];
var result = from r in dt.AsEnumerable()
group r by new { ID = r.Field<decimal>("ID"), time1 = r.Field<DateTime>("DATE") } into IdGroup
let row = IdGroup.First()
select new
{
ID = IdGroup.Key,
DATE = row.Field<DateTime>("DATE"),
CODE = row.Field<string>("CODE"),
NAME = row.Field<string>("NAME"),
NUMBER = row.Field<decimal?>("NUMBER"),
NAME = row.Field<string>("NAME"),
AMOUNT = row.Field<decimal>("AMOUNT")
};
var dtdata=result.ToList();
 
 how to convert datatable.
thnkx in adva 
 

Answers (5)