0
我會如何得到這樣的工作,以便我可以動態地改變這個LINQ中的where子句到sql查詢?動態在LINQ到SQL的地方
Dim AccountID = 1234
Dim AccountList
Select Case Types
Case 1
AccountList = (from a in dc.Accounts where a.ID = AccountID)
Case 2
AccountList = (from a in dc.Accounts where a.ID = AccountID And a.ParentID = AccountID)
Case Else
AccountList = (from a in dc.Accounts)
End Select
Return From p in dc.Products where AccountList.Contains(p.Order.Transaction.AccountID)
與上面的代碼我得到這個錯誤:
後期綁定操作不能轉換爲表達式樹
AccountList只是一個字符串列表,實際上它使IQueryable(的字符串)做了竅門 - 謝謝! – EdenMachine 2010-09-14 17:59:44