1
2
3
4
5
6
7
8
9
10
11 |
string [] roles = Roles.GetRolesForUser(); NNYZgbDataContext nnyzgb = new
NNYZgbDataContext(); aspnetdb.aspnetdbDataContext asp = new
aspnetdb.aspnetdbDataContext(); if
(roles.Contains( "yuanlingdao" ) || ShowUserAll()) { return ; } if
(roles.Contains( "Director" ) || roles.Contains( "Vice-Director" ) || roles.Contains( "secretary" )) { <span style= "color: rgb(255, 0, 0);" > e.Result = from
z in
nnyzgb.jisgwwwnfaInfo join
y in
asp.vwczcUsers on
z.RecorderUId equals
y.UserId where
!( bool )z.Inactive && y.dept == ((czc_user)Session[ "user" ]).Department orderby
z.RecordDate descending
select z;</span> } |
解决方法:
将红色的代码的nnyzgb.jisgwwwnfaInfo 改为:nnyzgb.jisgwwwnfaInfo.ToList() ,asp.vwczcUsers改为asp.vwczcUsers.ToList() ;
就是在表后 加上ToList();
linq 多表查询出现‘查询包含对不同数据上下文上所定义项的引用。’,布布扣,bubuko.com
linq 多表查询出现‘查询包含对不同数据上下文上所定义项的引用。’
原文:http://www.cnblogs.com/gaochun413/p/3600851.html