I have a LINQ to ENTITY query that pulls from a table, but I need to be able to create a \"fuzzy\" type search. So I need to add a where clause that searches by lastname IF
SELECT mem.LastName, mem.FirstName FROM Members mem WHERE mem.LastName = 'xxx'
That means that you want the last name to be equal to 'xxx'. What you write in your above post is that the lastname should contain 'xxx'.
To get it to equal you should write:
if (!String.IsNullOrEmpty(sLastName))
query = query.Where(ln => ln.LastName == sLastName);
Perhaps you should look at ignore case:
if (!String.IsNullOrEmpty(sLastName))
query = query.Where(ln => ln.LastName.Equals(sLastName, StringComparison.InvariantCultureIgnoreCase));