LINQ - Get all value with matching fields

Posted by Akiii under LINQ category on | Points: 40 | Views : 1765

var query = from h in dbk.Employee_table
where h.City == "London"
select h;

dbk = It is the DataContext object (With the help of this object, we can get access to any table in the respective database)

The above query will be translated to sql :-

SELECT Emp_ID, City, ...
FROM dbo.Employee_table
WHERE City = [London]

The above query will get all the rows in the employee table with city column containing "London" as it value.

Thanks and Regards

Comments or Responses

Login to post response