如何在linq实体中选择表值?

时间:2018-10-08 11:52:25

标签: linq lambda entities

数据库1:图书- TABLENAME1: BOOKINFORMATION1(ID,名称)

数据库2: BOOK2 TABLENAME2: BOOKINFORMATION2(ID,NAME)

我要先选择bookınformation1id,然后再选择bookınformation2id。我要选择具有相等linq的id,我想在其他表中添加相等的值( other table name:bookınformation3)。将此代码弄错。如何解决此问题。

var query1 = datatable1.AsEnumerable().Select(a => aID.ToString() }); 
var query2 = datatable2.AsEnumerable().Select(b => bID.ToString() });

var exceptAB = query1.Except(query2);

DataTable dtMisMatch = (from a in datatable1.AsEnumerable()
                           join ab in exceptAB on a.ID.ToString() equals 
                          ab.ID
                           select a).CopyToDataTable();

0 个答案:

没有答案