0
我有一個簡單If..Then像這樣:試圖LINQ到實體比較迄今導致錯誤
If rhcexists.First.SignatureDate > Date.Today.AddMonths(-6) Then
End If
rhcexists是一個簡單的查詢到實體模型:
Dim rhcexists = From p In dbContracts.Signatures _
Where p.StudentID = CStr(Session("people_code_id")) _
And p.ContractType = "rhc" _
Order By p.ID Descending _
Select p
問題是,這種比較產生一個錯誤:
LINQ to Entities does not recognize the method 'System.Object get_Item(System.String)' method, and this method cannot be translated into a store expression.
這發生在如果子句。任何想法爲什麼會發生這種情況,我該如何解決它?
我正在使用ASP.NET 4,EF 4和VS 2010 SP1。