DataContext db = new DataContext(conString);
var dvd = db.GetTable<DvdList>();
var query = from b in dvd
group b by b.CategoryId into g
select new { CategoryId = g.Key, GetTable<DvdList>()= g };
The error occurs at 开发者_如何学编程GetTable<DvdList>()= g
Your syntax makes no sense whatsoever.
If you just want the contents of the group, you don't need a select
clause at all; the group
clause returns a set of IGrouping<String, DvdList>
that is itself a set of DVDs.
GetTable<DvdList>()= g
is syntactically invalid. The left side declares the name of the property in the anonymous type that is created. <
, >
, (
and )
are invalid characters inside the name of a property.
精彩评论