Returning results using LINQ and multiple 'keywords'?

wJunuaonm

New Member
I'm new to ASP.Net and LINQ. I have a small project I'm working on. It basically consists of a screen with four text boxes, a listview control and a search button with one database table.Each text box represents a certain field: Author, Title, Publisher, and Price. What I envision is that a user would input text in one, or more, of the fields and hit the search button. The program would then return whatever results could be found that match the user's criteria.If I were using an SQL statement, I'd just select every record that matches any of the input fields (i.e. SELECT author, title, publisher, price FROM books WHERE...). However, I'm not quite sure how to do this with LINQ. So, does anyone have a starting point for me? I've seen LINQ examples with one field as a limiter on the search:\[code\]public void SimpleSearch(){ DataClasses1DataContext dc = new DataClasses1DataContext(); var q = from a in dc.GetTable<Books>() where a.Title == "1984" select a; dataGridView1.DataSource = q;}\[/code\]But I can't seem to find any other examples that use more than one limiter on the search. I'm beginning to think it isn't possible. If so, can someone recommend a different way for me to accomplish what I'm trying to do? Basically, I just want to search the table for fields that match the user's input and return the results in a listview. Any help would be greatly appreciate.
 
Top