本文介绍了使用LINQ选择多个字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


请帮帮我。



我需要用linq查询表并绑定从中返回的行对象的linq查询

hi
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;

推荐答案


这篇关于使用LINQ选择多个字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 04:22
查看更多