Select query using Linq to SQL in c# MVC

1296
Views
1
Answers

How to write a select query in Linq to SQL in c# MVC?

edit | flag
William Patrick
Asked on: Jun 16, 2011 at 5:07AM

1 Answers

18
2
18

Try this query..

NorthwindEntities dbContext = new NorthwindEntities();
           
var query = from p in dbContext.Products
                       
where p.ProductName == "Chai"
                       
select p;

This query returns all the rows form the table Products where the Product Name matches the given condition.

edit | flag
Gokul A
Answered on: Jun 16, 2011 at 8:48PM

Post your Answer

Search

Welcome to Ask Amoeba!
This is 100% free and interactive site for sharing professional Questions and Answers, Opensource projects, Interview questions.
Learners, beginners, Experts stop and share your knowledge and ideas!

Browse Categories

Browse Tags