我想使用linq进行选择:
Select cd.name from Content c, ContentDetail cd
where c.id_contentTypeID = contentTypeId and
c.id_contentID = contentID and
cd.id_contentID = c.contentID;
我已完成以下操作,但我不知道如何结束查询:
var list =
from c in guideContext.Content,
dc in guideContext.ContentDetail
where c.id_content == contentID &&
select dc;
有什么建议吗?
谢谢!
答案 0 :(得分:2)
您可以使用LINQ连接执行此操作,如以下示例所示:
var query = from c in guidecontext.Content
join cd in guidecontext.ContentDetail
on c.id_contentID equals cd.id_contendID
where c.id_contendID = contentId
&& c.contentTypeId = contentTypeId
select cd.name;
答案 1 :(得分:1)
这应该做的工作:
var list = from cd in guideContext.ContentDetail
where cd.id_contentID == contentID &&
cd.Content.id_contentTypeID == contentTypeId
select cd;