예제 #1
0
        private void btnNavProp_Click(object sender, EventArgs e)
        {
            northwindEntities dc = new northwindEntities();
            var query            = from c in dc.Customers
                                   where c.Orders.Count == 0
                                   select c;

            dataGridView2.DataSource = query.ToList();
        }
예제 #2
0
        private void btnWhereNot_Click(object sender, EventArgs e)
        {
            northwindEntities dc = new northwindEntities();

            var query = from c in dc.Customers
                        where !(from o in dc.Orders
                                select o.CustomerID).Distinct().Contains(c.CustomerID)
                        select c;

            dataGridView1.DataSource = query.ToList();
        }