使用了northwind数据库
using (var edm = new NorthwindEntities())
{var maxPrise = edm.Products.Max(p => p.UnitPrice);
Console.WriteLine(maxPrise.Value);//value获取当前值
}
using (var edc = new NorthwindEntities())
{
var query = from d in edc.Order_Details
join order in edc.Orders on d.OrderID equals order.OrderID
select new
{
OrderId = order.OrderID,
ProductId = d.ProductID,
Unitprice = d.UnitPrice
};
foreach (var q in query)
Console.WriteLine("{0},{1},{2}",q.OrderId,q.ProductId,q.Unitprice);
}