ASP.NET班组建设管理系统(7)

来源:xiaoniu168.com 作者:本站原创 添加时间:2012-03-06 点击数:14741

计算机毕业设计介绍:

5.3 利用存储过程管理角色部分代码
con.ConnectionString = db.getconstr();
        sqlstr = "select * from vwRole where roleName='" + this.droprole.SelectedItem.Text + "' and 用户序号='" + Session["uid"].ToString() + "'";
        ds = db.getdatadysql(sqlstr);
        if (ds.Tables[0].Rows.Count != 0)
        {
            this.labmsg.Text = "";
        }
        else
        {
            if (Session["j"].Equals("1"))
            {
              
               com = new SqlCommand("proInsertRole", con);
                com.CommandType = CommandType.StoredProcedure;
                param = com.Parameters.Add("@urolename", SqlDbType.NVarChar, 50);
                param.Value = this.droprole.SelectedItem.Text.ToString();
                param = com.Parameters.Add("@uid", SqlDbType.Int);
                param.Value = int.Parse(Session["uid"].ToString());
                param = com.Parameters.Add("@ulimit", SqlDbType.NVarChar, 50);
                param.Value = this.tbulimit.Text.ToString();
                con.Open();
                com.ExecuteNonQuery();
                con.Close();
                this.labmsg.Text = "";
                this.Panel1.Visible = false;
            }
            else
            {

                com = new SqlCommand("proUpdateRole", con);
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.Add("@urolename", SqlDbType.NVarChar, 50);
                com.Parameters.Add("@uid", SqlDbType.Int);
                com.Parameters.Add("@ulimit", SqlDbType.NVarChar, 50);
                com.Parameters.Add("@uroleid", SqlDbType.Int);
                com.Parameters["@urolename"].Value = this.droprole.SelectedItem.Text.ToString();
                com.Parameters["@uid"].Value = int.Parse(Session["uid"].ToString());
                com.Parameters["@ulimit"].Value = this.tbulimit.Text.ToString();
                com.Parameters["@uroleid"].Value = int.Parse(Session["rid"].ToString());
                con.Open();
                com.ExecuteNonQuery();
                con.Close();
                this.labmsg.Text = "";

                this.Panel1.Visible = false;
            }
            sqlstr = "select * from vwRole where 用户序号='" + Session["uid"].ToString() + "'";
            databind();
        }
        Session["rid"] = null;

<责任编辑:计算机毕业设计网(http://www.xiaoniu168.com)>

第1页第2页第3页第4页第5页第6页第7页

【联系方式】

【本站信誉】

用心做计算机毕业设计论文网