vb.net - Group By LINQ Dyanmic Query -
i trying allow user change query dynamically querystring parameter. having trouble getting group work in vb.net. wanting return id, name, , count of each group.
' load of types dim basequery = db.answers _ .where(function(a) a.question.correctanswer <> a.answer) _ .where(function(a) a.question.typeid = typeid) if catid <> 0 basequery = basequery _ .where(function(x) x.question.categoryid = catid) _ .tolist() end if if approachid <> 0 basequery = basequery _ .where(function(x) x.approachid = approachid) _ .tolist() end if dim grouppedquestiontypesincorrecttotal = basequery _ .groupby(function(x) x.question.typeid) _ .select(function(x) new {.id = x.id}) _ .tolist() dim grouppedcategorieincorrecttotal = basequery _ .groupby(function(x) x.question.categoryid) _ .tolist() dim grouppedapproachesincorrecttotal = basequery _ .groupby(function(x) x.approachid) _ .tolist() viewbag.questiontypes = grouppedquestiontypesincorrecttotal viewbag.categories = grouppedcategorieincorrecttotal viewbag.approaches = grouppedapproachesincorrecttotal
Comments
Post a Comment