I am trying to make a simple search method using LINQ to SQL in Visual Studio. In my database, I have the fields “Firstname” and “Lastname”, and my search string is “name”. How can I make a simple LINQ query which searches both fields?
In plain SQL I would do something like this:
SELECT (Firstname + Lastname) as 'Fullname'
FROM table
WHERE Fullname LIKE '%searchstring%'
The usual thing to do is this:
This however is not equivalent to your SQL query. The following is equivalent: