一个表列中有两个表是 FID .. FID 在表中'tblRe '
,在 db 中的类型是字符串,在另一个表列中是 MID .. MID 在表中'tblVeh'
,在 db 中的类型是 int 两个值相同但名称不同。我尝试调整,但这显示错误
string data = "[";
var re = (from veh in DB.tblVeh
join regh in DB.tblRe on
new{MID=veh .MID} equals new {MID=tblRe .FID}
where !(veh .VName == "")
group veh by veh .VName into g
select new
{
Name = g.Key,
cnt = g.Select(t => t.Name).Count()
}).ToList();
data += re.ToList().Select(x => "['" + x.Name + "'," + x.cnt + "]")
.Aggregate((a, b) => a + "," + b);
data += "]";
我试试这个
new{MID=veh .MID} equals new {MID=tblRe .FID}
错误
The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.
任何解决方案