日期:2014-05-20  浏览次数:20825 次

刚学LINQ & Entity Framework,遇到两个表连接查询的问题,请高手指教,我的错误代码如下!
private zysoftEntities ctxZySoft = null;
  protected void Page_Load(object sender, EventArgs e)
  {
  ctxZySoft = new zysoftEntities();
  var st1 = from c in ctxZySoft.Sys_Tree
  join o in ctxZySoft.Sys_RolePerm on c.id equals o.P_PageCode into co
  from d in co.DefaultIfEmpty()
  select new
  {
  c,
  d
  };
  }
  }
这段代码红色部分提示错误!

------解决方案--------------------
var st1 = from c in ctxZySoft.Sys_Tree
join o from ctxZySoft.Sys_RolePerm on c.id equals o.P_PageCode into co
from d in co.DefaultIfEmpty()
select new

------解决方案--------------------
建议你看下这个:

http://www.cnblogs.com/lyj/archive/2008/01/24/1051495.html
------解决方案--------------------
探讨

var st1 = from c in ctxZySoft.Sys_Tree
join o from ctxZySoft.Sys_RolePerm on c.id equals o.P_PageCode into co
from d in co.DefaultIfEmpty()
select new

------解决方案--------------------
好像 没有错, 再 检查 新编译一下。
------解决方案--------------------
探讨
var st1 = from c in ctxZySoft.Sys_Tree
join o from ctxZySoft.Sys_RolePerm on c.id equals o.P_PageCode into co
from d in co.DefaultIfEmpty()
select new

------解决方案--------------------
提示错误信息是什么?