示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AdventureWorks_DataEntities1 adventureWorks_DataEntities =
                new AdventureWorks_DataEntities1();

            var query = from c in adventureWorks_DataEntities.Customers
                        where c is IndividualCustomer
                        select c;

            GridView1.DataSource = query;
            GridView1.DataBind();
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AdventureWorks_DataEntities1 adventureWorks_DataEntities = new AdventureWorks_DataEntities1();

            var query = from o in
                            adventureWorks_DataEntities.SalesOrderHeaders
                        where o.SalesOrderDetails.Any(Quantity =>
                           Quantity.OrderQty > 5)
                        select new
                        {
                            o.PurchaseOrderNumber,
                            o.Customer.CustomerID,
                            o.SalesPersonID
                        };

            GridView1.DataSource = query;
            GridView1.DataBind();
        }