I am working on a search web page for my site. The requirements state that users can enter text for any combination of 9+ fields and the search should do an 'AND' match when querying the database. I could fairly quickly write this as a stored procedure using 'ISNULL' but I'm trying to figure out how to accomplish the same thing in LINQ. I thought I could query the results of a query, but I'm getting the error
"Only arguments that can be evaluated on the client are supported for the String.Contains method"
Here's my example
var people = db.People
if(null != fname)
{
people= from e in people
where e.FirstName.Contains(fname)
select e;
}
if(null != lname)
{
people= from e in people
where e.LastName.Contains(lname)
select e;
}
return people;
Can I query the resultset of a previous query? Is there a better approach I'm just not thinking of?
Thanks in advance.