关于一个查询的问题
from i in dc.InfoContent
where i.imgUrl != ""
orderby i.infoID descending
select new
{
infoID = i.infoID,
infoTitle = i.infoTitle,
imgUrl = i.imgUrl,
moduleID = i.moduleID,
};
这里有个问题 moduleID 是1-9 我现在只要查moduleID =1,2,3,5里的 怎么查啊 谢谢
------解决方案--------------------这个楼主应该一定看得懂把。。。。
from i in dc.InfoContent
where i.imgUrl != "" && (i.moduleID=1 || i.moduleID=2 || i.moduleID=3) || i.moduleID=5)
orderby i.infoID descending
select new
{
infoID = i.infoID,
infoTitle = i.infoTitle,
imgUrl = i.imgUrl,
moduleID = i.moduleID,
};
------解决方案--------------------C# code
from i in dc.InfoContent
where i.imgUrl != ""
&& new string[]{"1","2","3","5"}.Contains(i.moduleID)
orderby i.infoID descending
select new
{
infoID = i.infoID,
infoTitle = i.infoTitle,
imgUrl = i.imgUrl,
moduleID = i.moduleID,
};