谢谢斑竹!
问题一 中如果使用第二种方式,在“更新权限”时需将数据库中该角色的所有数据行删除,然后再重新添加该角色与所有任务的关系。以下的代码实现了将权限重新写入数据表,不知是否还有更加好的方法。
CheckBox chk;
        foreach (GridViewRow r in GridView2.Rows)
        {
            chk = (CheckBox)r.FindControl("Checkbox1");
            if (chk != null)
            {
                if (chk.Checked)
                {
                    DataRow addrow = ds1.Tables[0].NewRow();
                    //addrow[1] = Session["JsId"].ToString();
                    addrow["RoleId"] = GridView1.SelectedRow.Cells[0].Text.Trim();
                    addrow["GongNeng_Id"] = r.Cells[0].Text.Trim();
                    ds1.Tables[0].Rows.Add(addrow);
                    da1.Update(ds1, "relRoleAndAuthority");
                }
            }
        }
问题二 ,如何将从数据库筛选出来的数据放在 ArrayList 中?以下代码不会怎样写了(红色部分),请帮忙,谢谢!
SqlConnection conn = new SqlConnection("data source=(local);database=****;user=****; password=****");
        DataSet ds = new DataSet();
        SqlDataAdapter da = new SqlDataAdapter("select GongNeng_Id from relRoleAndAuthority where RoleId = " + GridView1.SelectedRow.Cells[0].Text, conn);
        da.Fill(ds, "Authority");
        ArrayList MyList = new ArrayList();
       MyList = ds.Tables["Authority"].Rows;
        ????
        foreach (GridViewRow row in GridView2.Rows)
        {
            if (MyList.Contains(row.Cells[1].Text))
            {
                CheckBox checkBox = (CheckBox)row.FindControl("CheckBox1");
                checkBox.Checked = true;
            }
        }
[此贴子已经被作者于2007-7-31 11:10:47编辑过]

我是2.0超级菜鸟,请多多教导!



											
	    

	
