
var Customers = context.Customer
.Where(c => c.Name == "Vam");
we have used Where method which is a LINQ method. The Where method requires a condition as a parameter which we write as a lamda expression. The Lamda expressin starts with a control variable, followed by => and then the expression. The query returns all the customers whose names are “Vam”.
using (var context = new SalesOrderManagementEntities())
{
var Customers = context.Customer
.Where(c => c.Name == "Vam");
foreach (var Customer in Customers)
{
Console.WriteLine(String.Format("{0}",
Customer.CustomerId));
}
Console.WriteLine();
Console.ReadLine();
}
The below is a VB LINQ to Entities query using the method based syntax.
Copyright © 2012 - All Rights Reserved - VKInfotek.com