Convert var to DataTable
Posted
by cre-johnny07
on Stack Overflow
See other posts from Stack Overflow
or by cre-johnny07
Published on 2010-05-13T06:49:47Z
Indexed on
2010/05/13
6:54 UTC
Read the original article
Hit count: 505
linq-to-sql
|c#
I have var item which I want to convert in to a Datatable. How can I do this.
var items = (from myObj in this.Context.Orders
group myObj by myObj.OrderDate.ToString("yyyy-mm")
into ymGroup
select new { Date = ymGroup.Key, Start = ymGroup.Min(c => c.OrderId), End = ymGroup.Max(c => c.OrderId) });
I need to convert the items into a DataTable. I don't want to use any foreach loop. How can I do this.?
© Stack Overflow or respective owner