本文介绍了Linq to sql中如何进行连接查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

var query2 =(来自pd.Student1s中的pd,在pd.id上的db.Test_1s中加入od等于od.No选择新的{od.Name,pd.name})。ToList();





错误:

var query2 = (from pd in db.Student1s join od in db.Test_1s on pd.id equals od.No select new { od.Name, pd.name }).ToList();


Error :

The type of one of the expressions in the join clause is incorrect.  Type inference failed in the call to

推荐答案


var query2 = (from pd in db.Student1s
              join od in db.Test_1s on pd.id equals od.No
              select new
                {
                    od.Name,
                    pd.name
                }).ToList();



这篇关于Linq to sql中如何进行连接查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 13:28
查看更多