0
我正在使用LINQ
來根據特定條件選擇列表。該屬性值存儲在byte array
中,後者在存儲到數據庫表中時被加密。我想現在我SELECT LINQ
查詢中使用此屬性,但它拋出以下異常,當我嘗試:GetBytes方法無法轉換爲商店表達式
LINQ to Entities does not recognize the method 'Byte[] GetBytes(System.String)' method, and this method cannot be translated into a store expression.
這是我使用的代碼:我想選擇
var result = (from history in context.Histories
where history.ID == Id &
(history.Salary != null || history.Salary != Encoding.ASCII.GetBytes("0"))
select (DateTime?)history.Date).Max();
return result;
歷史記錄表中的日期,這些ID的工資不等於null或0.我該如何更改?
謝謝
LINQ無法判斷您的GetBytes會!像魅力一樣工作! – faizanjehangir