Click here to Skip to main content
15,790,723 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
pls help me.

I need to query a table with linq and bind the rows returned from the linq query to an object
WebChatDBDataContext dataContext = new WebChatDBDataContext();
var executiveSession= dataContext.ExecutiveSessions.FirstOrDefault(s => s.SessionId == httpcontext.Session.SessionID);
var talkerId = (from cRoom in dataContext.ChatRooms
where cRoom.ExecutiveId == executiveSession.ExecutiveSessionId
select cRoom.TalkerId
var msglst = from msgPool in dataContext.MessagePools
 where msgPool.TalkerId == ???// who has talkerId which is selected by last query

select msglst;

1 solution

You could use joins here. Check this link about LINQ[^].

Basically, you are looking to join ChatRooms to MessagePools on TalkerId.
Share this answer
jeetveer 21-Jan-13 2:15am    
ok i will try... thanx for suggesstion

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