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