日期:2014-05-20 浏览次数:20911 次
public List<tblA> Select(int tblAId, string theName, string theRealName) { IQueryable<tblA> q = db.tblA; if(tblAId > 0) q = q.Where(p => p.Id == tblAId); if(!string.IsNullOrEmpty(theName)) q = q.Where(p => p.Name == theName); if(!string.IsNullOrEmpty(theRealName)) //这里不知道该怎么写了 return q.ToList(); }
public List<tblA> Select(int tblAId, string theName, string theRealName) { IQueryable<tblA> q = db.tblA; if(tblAId > 0) q = q.Where(p => p.Id == tblAId); if(!string.IsNullOrEmpty(theName)) q = q.Where(p => p.Name == theName); if(!string.IsNullOrEmpty(theRealName)) q=from x in q join y in db.tableB on x.Id equals y.aId where y.realName==theRealName select x; return q.ToList(); }