1
Vote

Can only have one Where expression

description

Dear Sir,
I try to build a search query but i receive a error:
using (var adapter = TableAdapter<Questions>.Open())
            {
                var result = adapter.Select();
                if (model.ExamDateSelectedItems != null && model.ExamDateSelectedItems.Length > 0)
                {
                    var date = model.ExamDateSelectedItems[0];
                    result = result.Where(x => x.ExamDate == date);
                }
                if (model.TechniqueSelectedItems != null && model.TechniqueSelectedItems.Length > 0)
                {
                    var tech = model.TechniqueSelectedItems[0];
                    result = result.Where(x => x.Technique == tech);
                }
                if (model.TopicSelectedItems != null && model.TopicSelectedItems.Length > 0)
                {
                    var topic = model.TopicSelectedItems[0];
                    result = result.Where(x => x.Topic == topic);
                }
                if (result.ToList().Count > 0)
                {
                    return PartialView("_Download", result.ToList());
                }
            }
The error is: Can only have one Where expression
This is happen when have 2 selected options

Please advise.

Best regards,
Saykor

comments