For a queryoutput i use the query below. CMList is a list of checkbox checked values, the other parameters are read from textboxes.
A user can select a item from the checkboxlist, if all other textboxes for paramters are empty he should see all the records matching the checked items. When one or more textboxes have parameters the query should be the selected checkbox items Plus the textbox values. But when nothing in the checkbox is selected, but the textbox(es) are filled then also the records matching the textbox parameters should be shown.
How can I achieve this? With the Or clause you see records which match he first checkbox or the textboxfield and so on. As far as i can see it it should be a complicated AND clause?
Thanks in advance,
Dim output = (From C In dc.tbl_items Where (CMList.Contains(C.itemdescription)) _
Or (C.date1 >= d1from And C.date1 <= d1to) _
Or (C.lastrep >= Vfrom And C.lastrep <= Vto) _
Or (C.km >= kfrom And C.km <= kto) _
Or (C.date2 >= d2from And C.date2 <= d2to) Select C).ToList()
View Complete Post