Link to home
Start Free TrialLog in
Avatar of kravindra
kravindra

asked on

How to use like operator in LINQ

i need to perform search operation using linq. suppose if the user enter a character 'p',i need to show all the records starts with that letter(both lower as well as captial letter records start's with p).
ASKER CERTIFIED SOLUTION
Avatar of Craig Wagner
Craig Wagner
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
string sDescript = "p"
sDescript = sDescript.ToUpper();

(from a in GetStoredProcedureResult
                                             where a.descript.ToUpper().StartsWith(sDescript)
                                             select a).FirstOrDefault();

BTW, if all characters in the database are already UPPERCASE, you do not need .ToUpper() in LINQ.

HTH
Ashok
Regarding that post

here is the link where I found the info (Original date: 08-11-2006)

http://codebetter.com/blogs/peter.van.ooijen/archive/2006/08/11/Change-a-database-connection-string-from-code.aspx

Not sure if it is still valid (I mean today).
Wrong place
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't understand... the author requested the question be deleted because he accepts an answer?
Yes kravindra you have asked a question that has been comprehensively answered. Why request a delete?

DaTribe
Accept posts:

ID: http:#a26064241
ID: http:#a26064307
ID: http:#a26099440

Split points