0
我有要求,我只想返回基於服務狀態,完成/否的唯一供應商ID列表;您是否缺少using指令或程序集引用?實體框架Distinct Function
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();
}
「System.Nullable」不包含「ServiceStatus」的定義,並沒有擴展方法「ServiceStatus」接受型「System.Nullable」的第一個參數可以找到(是否缺少using指令或一個程序集參考?)
謝謝主席先生,但我怎麼能回到它通過功能列表或列表 ....在這兩種情況下顯示 –
您的返回類型更改爲'名單'erorr。 'VendorId'是一個可空的int('int?')。 –
謝謝先生的捆綁,我從昨天開始真的很頭痛:)現在它的工作很好 –