Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey

in below query i want to get count of answer to a question

C#
(from sq in context.TblStudentQues
                                 join asq in context.TblAnswerStudentQues on sq.IDstques equals asq.IDMaster
                                 join u in context.TblUsers on sq.IDUser equals u.IDUser 
                                 group asq by asq.ID into cc
                                 select new {u.FamilyName,cc.Count() }).ToList();

my code doesn't work . why ?
Posted
Updated 11-Jul-13 20:19pm
v3
Comments
_Asif_ 12-Jul-13 0:32am    
Seems like problem is in your join condition. Simplify your join and check again
aref.bozorgmehr 12-Jul-13 1:29am    
what can i to do ?
StM0n 12-Jul-13 2:23am    
should there really be two commas?!

(Moved up from Solution due it was a question but needed formatting; no need to answer :)

C#
(from sq in context.TblStudentQues
                                 join asq in context.TblAnswerStudentQues on sq.IDstques equals asq.IDMaster
                                 join u in context.TblUsers on sq.IDUser equals u.IDUser 
                                 group asq by asq.ID into cc
                                 select new {asq.ID,cc.Count() }).ToList();
 
Share this answer
 
Comments
aref.bozorgmehr 12-Jul-13 4:27am    
Error Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.
maneavnash 12-Jul-13 5:02am    
(from sq in context.TblStudentQues
join asq in context.TblAnswerStudentQues on sq.IDstques equals asq.IDMaster
join u in context.TblUsers on sq.IDUser equals u.IDUser
group asq by asq.ID into cc
select new {cc.asq.ID,cc.Count() }).ToList();
aref.bozorgmehr 12-Jul-13 6:20am    
isn't true

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900