コード例 #1
0
        private void loadAllCustomers()
        {
            using (var db = new DemoxOyEntities())
            {
                var query = from a in db.asiakas
                            select a;

                gridView.DataSource = query.ToList();
                gridView.DataBind();
            }
        }
コード例 #2
0
        private void groupByCountry(string country)
        {
            using (var db = new DemoxOyEntities())
            {
                var query = from a in db.asiakas
                            orderby a.maa
                            select a;

                gridView.DataSource = query.ToList();
                gridView.DataBind();
            }
        }
コード例 #3
0
        private void loadFromCountry(String country)
        {
            using (var db = new DemoxOyEntities())
            {
                var query = from a in db.asiakas
                            where a.maa == country
                            select a;

                gridView.DataSource = query.ToList();
                gridView.DataBind();
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                using (var db = new DemoxOyEntities())
                {
                    var query = from t in db.asiakas
                                select t.maa;

                    // Valitaan uniikit maat DropDownListiin.
                    ddMaat.DataSource = query.Distinct().ToList();
                    ddMaat.DataBind();
                }
            }
        }