我试图将SQL
转换为LINK
查询
我试试这个
SQL
查询
Select name, count(*) from tblVehicles
WHERE MID = 23065 and name<> '' Group By name
LINQ
查询
var re = (from vehvoila in DB.tblVehicles
where vehvoila.MID='23065' && vehvoila.name
group vehvoila by new{vehvoila.name} into g
select new
{
g.Key.name,
cnt=g.Select(t=>t.name).Count()
});
如何在<>中使用LINQ
?
发布于 2016-06-07 23:25:25
对你有用的是
where vehvoila.MID == "23065" && !(vehvoila.name == null || vehvoila.name == "")
或者只是
where vehvoila.MID == "23065" && vehvoila.name != ""
Linq中不支持的String.IsNullOrEmpty
:
方法'Boolean (System.String)‘不支持转换到SQL。
https://stackoverflow.com/questions/37695663
复制相似问题