Is there a LINQ To SQL equivalent to the SQL between keyword?
Do I just need to And both comparisons?
SELECT first_name, last_name
FROM people
WHERE last_name between 'Smith' and 'Thompson'
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume you mean “in Linq to Sql”. Linq by itself just passes the expression to the LinqProvider which translates it into something appropriate for the data store being queried.
That being said, I’m pretty sure that the MSSQL provider used by Linq to Sql will translate
last_name >= "Smith" and last_name <= "Thomson"into aBETWEENexpression.UPDATE: Empirical evidence (via LINQPad) shows that it does not translate to
BETWEEN