Click here to Skip to main content
15,891,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi
I have a SQL query with LIKE operator. Now I want to convert this SQL query in Linq.

can anyone help me to solve this ?
Thanks in advanced.

What I have tried:

This is my SQL query:
select designation_name, salary from dbo.Designation as d inner join empSalary as eb on d.salary_id = eb.salary_id
where eb.salary > 17500 AND d.designation_name LIKE '%Dev%'
Posted
Updated 8-Oct-19 20:11pm
v2

1 solution

Like operator in SQL is equal to Contains()[^] in Linq.

C#
var query = from d in Designation
join eb in empSalary on d.salary_id equals eb.salary_id
where eb.salary > 17500 and d.designation_name.Contains("Dev")
select new {...};
 
Share this answer
 
Comments
MadMyche 9-Oct-19 6:55am    
+5
Maciej Los 9-Oct-19 7:20am    
Thank you.
[no name] 16-Oct-19 2:05am    
Thank you for this answer.
Maciej Los 16-Oct-19 6:09am    
You're very welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900