Northwind数据库的查询结果绑定到gridview的问题

来源:互联网 发布:淘宝十大女装店 编辑:程序博客网 时间:2024/04/20 04:08

protected void query_Click(object sender, EventArgs e)
        {
            DAL.Founction A = new DAL.Founction();
            A.EDM = new EFModel.NORTHWNDEntities();
            GridView2.DataSource = A.SelectRecordByIDList(upd.Text);
            GridView2.DataBind();

        }

public List<Customers> SelectRecordByIDList(string customerID)//查询特定的一条记录
        {
            try
            {
                List<Customers> listCustomer = new List<Customers>();
                ObjectQuery<Customers> customers = _edm.Customers;
                listCustomer.Add(_edm.Customers.Where(c => c.CustomerID == customerID).First());
                return listCustomer;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

原创粉丝点击