8,497
社区成员
发帖
与我相关
我的任务
分享
//这样分成两步可以
var rootid = (from c in ctx.mf_ProductClass where c.ClassID == int.Parse(classid) select c.ParentPath).First().Split(',')[1];
var attlist = from p in ctx.View_mf_ProductAttList where p.ClassID == Convert.ToInt16(rootid) select p;
//这样合成一步就出错:无法识别的表达式节点: ArrayIndex
var attlist = from p in ctx.View_mf_ProductAttList where (from c in ctx.mf_ProductClass where c.ClassID == int.Parse(classid) select c.ParentPath).First().Split(',')[1].Contains(p.ClassID.ToString()) select p;
//这样也不行,还是同样的错误
var attlist = from p in ctx.View_mf_ProductAttList where p.ClassID == Convert.ToInt16((from c in ctx.mf_ProductClass where c.ClassID == int.Parse(classid) select c.ParentPath).First().Split(',')[1]) select p;
var attlist = from p in ctx.View_mf_ProductAttList
let rootid= from c in ctx.mf_ProductClass.ToList()
where c.ClassID == Convert.ToInt32(classid)
select c.ParentPath).First().Split(',')[1]
where p.ClassID == Convert.ToInt32(rootid)
select p;
var attlist = from p in ctx.View_mf_ProductAttList
let rootid= from c in ctx.mf_ProductClass
where c.ClassID == int.Parse(classid)
select c.ParentPath).First()
where (","+rootid+",").Contains(","+p.ClassID+",")
select p;