
Question:
This question already has an answer here:
Let's say I have a MS-SQL 2005 table named "People" with the following rows:
|FirstName|LastName| |JD |Conley | |Joe |Schmo | |Mary |Jane |
I want to execute a SQL statement like:
select * from People where FirstName > 'JD'
The problem I'm having is I can't think of a way to get LINQ to SQL to generate this SQL statement. Obviously I can't use ">" and "<" operators on strings in C#.
Solution:1
You want String.CompareTo
here
var query = from p in db.People where p.FirstName.CompareTo("JD") > 0 select p;
Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
EmoticonEmoticon