Hello, I have a LINQ query:
And I want to pass it to a function to filter it, like this:VB Code:
Dim Db = New MyDataContext Dim Qry = From cust in Db.Customers Select cust.ID, cust.Name
VB Code:
FilterAnyQuery(Qry, cust.ID) ' WHERE "cust.ID" CAN BE ANY FIELD
The Sub should be of this kind:
VB Code:
Sub FilterAnyQuery(ByVal AnyQry As iQueryable, AnyField as ???) AnyQry = AnyQry.Where(AnyField = "somevalue") End Sub
How can I pass "AnyField" to the Sub and make the LINQ "Where" clause work?
Is there any workaround?
Thank you.




Reply With Quote