I have an question.
I use a dynamic creation for an advertisment file. So the user can check/uncheck some Options in my Environment and then the query should fire.
This Looks like this:
Code: Select all
Dim myDataContext as New VOptNeu.DataContext Dim customer = From Query in myDataContext If checkDateFrom = True Then customer = customer.Where(Function (x) x.datefrom >= datefrom.Value End If If checkDateUntil = True Then customer = customer.Where(Function (x) x.datefrom <= dateuntil.Value End If
It Looks, that this Kind of dynamic creation does not Combine the where clauses!? - Am I right? - How could I do it, that the where's are combined?
I know, the correct behaivor would be to use Between, but as you can see, it could be that the checkDateUntil is not checked, so there would be no Kind of between.
Also the Problem Comes, when I make more of this queries.
Hope you understand and know what could help