// 绑定管理员列表
    public void gridviewBind()
    {
        DataTable gd = am.SelectAll();

        GridView1.DataSource = gd;
        GridView1.DataBind();
    }
Exemplo n.º 2
0
    void EntityDataSource()
    {
        AdminsManage am = new AdminsManage();
        var          dt = am.SelectAll();// 获取数据库中所有数据

        // 清除数据源
        DataSource.Rows.Clear();
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            DataRow row = DataSource.NewRow();
            row["编号"] = dt.Rows[i]["adminId"];
            row["名称"] = dt.Rows[i]["name"];
            row["编号"] = dt.Rows[i]["cellphone"];
            DataSource.Rows.Add(row);
        }
        gvwRoleBind();
    }