linq to entity 中如何使用sql语句
展开全部
NorthwindEntities entities = new NorthwindEntities();
var ordersOf1996 = from order in entities.Orders
where order.OrderDate < new DateTime(1997, 1, 1)
select new
{
order.OrderID,
order.OrderDate,
order.ShipCity,
order.Customers.CompanyName
};
this.GridView1.DataSource = ordersOf1996.Take(20);
this.GridView1.DataBind();
var ordersOf1996 = from order in entities.Orders
where order.OrderDate < new DateTime(1997, 1, 1)
select new
{
order.OrderID,
order.OrderDate,
order.ShipCity,
order.Customers.CompanyName
};
this.GridView1.DataSource = ordersOf1996.Take(20);
this.GridView1.DataBind();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询