Hello everybody.
can you please help me out with this? i need to filter an IEnumerable resultset returned from a linq2sql statement. the filter has to be a string which includes the relevant criteria.
here is my current code:
Code:
Dim ps As String = UserPermission("Task")
Dim dcx AsNew MainBaseDataContext
Tasks = From t In dcx.Tasks.Where(ps)
obviously this doesnt work, the compiler complains that no overloaded version of 'Where' accepts this number of arguments.
the need/goal:
UserPermission is a function that looks up different permissions set in the db for users of different departments in the company and returns a criteria string. the string may look something like "(assignedto=99 or doneby=99) and deptID in(2,4,7)" or any other sql filter.
this must be the first filter assigned to any LINQ select method.
after that the UI needs to be able to filter further according to user input so i have the following code:
Code:
If ddlResolvedF.SelectedValue <> ""Then Tasks = From t In Tasks Where (t.DoneBy IsNothing) = ddlResolvedF.SelectedValue
If ddlActiveF.SelectedValue <> ""Then Tasks = From t In Tasks Where t.Active = ddlActiveF.SelectedValue
so the question boils down to this: How can I apply a criteria string to an IEnumerable returned from linq2sql?
thank you all for your time and waiting for your responses.
all the best
Yisman