日期:2014-05-20 浏览次数:21151 次
var q = from x in db.Companys
from y in db.Departments
where x.DepartmentId == y.Id && y.Name == "业务部"
select x;
IQueryable<Companys> orders = entity.Companys.Join(entity.Departments.where(a => a.Name = "业务部"), b => b.Id, s => s.DepartmentId, (m, n) => m);
IQueryable<PARA_COMPANYS> modelL = db.PARA_COMPANYS;
//添加查询条件
if (!string.IsNullOrEmpty(strCODE_NO))
{
modelL = modelL.Where(p => p.CODE_NO == strCODE_NO);
}
//后面加if就行了 最后得到modelL