Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 是否缺少using指令或程序集引用?实体框架独立功能_C#_Sql Server_Entity Framework_Entity Framework 4 - Fatal编程技术网

C# 是否缺少using指令或程序集引用?实体框架独立功能

C# 是否缺少using指令或程序集引用?实体框架独立功能,c#,sql-server,entity-framework,entity-framework-4,C#,Sql Server,Entity Framework,Entity Framework 4,我有要求,我只想返回基于服务状态的唯一供应商ID列表,完成/否 Select Distinct(vendorid) FROM DC_System_Assets where ServiceStatus='Done' 我试着那样写,但是写错了 public List<int> AutoScheduleMails() { var v = db.DC_System_Assets.Select(f => f.VendorId).Distinct().Where(p =>

我有要求,我只想返回基于服务状态的唯一供应商ID列表,完成/否

Select Distinct(vendorid) FROM DC_System_Assets where ServiceStatus='Done'
我试着那样写,但是写错了

public List<int> AutoScheduleMails()
{
    var v = db.DC_System_Assets.Select(f => f.VendorId).Distinct().Where(p => p.ServiceStatus == "Done").ToList();
}
public List AutoScheduleMails()
{
var v=db.DC\u System\u Assets.Select(f=>f.VendorId).Distinct()。其中(p=>p.serviceststatus==“Done”).ToList();
}
“System.Nullable”不包含的定义 “ServiceStatus”和没有扩展方法“ServiceStatus”接受 找不到类型为“System.Nullable”的第一个参数(是否为 缺少使用指令或程序集引用?)


您正在选择一个
VendorId
s列表,然后尝试按
ServiceStatus
进行筛选(这不是
VendorId
的属性)。试试看


谢谢,先生,但是我如何通过函数列表或列表返回它。。。。在这两种情况下,请将退货类型更改为
列表
VendorId
是一个可为空的int(
int?
)。非常感谢,先生,从昨天开始我就感到头疼:)现在工作正常了
var v = db.DC_System_Assets
            .Where(a => a.ServiceStatus == "Done")
            .Select(a => a.VendorId)
            .Distinct()
            .ToList();