Esempio n. 1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string sqlstr = string.Format("insert into td_user(UserName,PassWord,Email,Role) values('{0}','{1}','{2}','{3}')", txtUserName.Text, txtPassWord.Text, txtEmail.Text, "普通用户");
            bool   yesno  = DBhelper.InsertUpdateDel(sqlstr);

            if (yesno == true)
            {
                txtEmail.Text     = "";
                txtPassWord.Text  = "";
                txtPassWord2.Text = "";
                txtUserName.Text  = "";
                Response.Write("<script>alert('注册成功!')</script>");
            }
            else
            {
                Response.Write("<script>alert('注册失败!')</script>");
            }
        }
Esempio n. 2
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (Session["Role"].ToString() == "管理员")
     {
         string sqlstr = string.Format("insert into td_user(UserName,PassWord,Email,Role) values('{0}','{1}','{2}','{3}')", txtUserName.Text, txtPassWord.Text, txtEmail.Text, txtEmail.Text, DropDownList1.SelectedItem.Text);
         bool   yesno  = DBhelper.InsertUpdateDel(sqlstr);
         if (yesno == true)
         {
             Response.Write("<script>alert('保存成功')</script>");
         }
         else
         {
             Response.Write("<script>alert('保存失败')</script>");
         }
     }
     else
     {
         Response.Write("<script>alert('无权限!')</script>");
     }
 }