I have two DataTables , Items and its Groups. I have a linq query to get item Name and its Group Name by joining the 2 tables.
EnumerableRowCollection<DataRow> dvquery = (from item in Items.AsEnumerable()
join grp in groups.AsEnumerable()
on item.Field<byte>("Group_ID") equals grp.Field<byte>("ID")
into item_grp_join
from itemgrp in item_grp_join
select new
{
ItemName = (string)led.Field<string>("Name"),
GName = (string)itemgrp.Field<string>("Name"),
});
DataView dv = dvquery.AsDataView();
However I am getting compile time error as
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'System.Data.EnumerableRowCollection'. An explicity conversion exists (are you missing a cast?)
How to solve this error? I can easily convert the query result into a list but I need to have a dataview only , so as I can give it as datasource to grid.
Any help appreciated. Thanks