Example #1
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtUserName.Text))
            {
                Response.Write("<script>alert('请输入用户名')</script>");
                return;
            }
            if (string.IsNullOrWhiteSpace(txtUserPwd.Value))
            {
                Response.Write("<script>alert('请输入密码')</script>");
                return;
            }

            int id = SimpleSqlserverHelper.ExecuteNonQuery("Insert into Users (UserName,UserPwd)Values('" + txtUserName.Text + "','" + txtUserPwd.Value + "')");

            if (id > 0)
            {
                Response.Write("<script>alert('注册成功')</script>");
                Response.Redirect("Default.aspx");
            }
            else
            {
                Response.Write("<script>alert('注册失败')</script>");
            }
        }
Example #2
0
        /// <summary>
        /// 取消
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //protected void gvwUsers_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
        //{
        //    gvwUsers.EditIndex = -1;
        //    dataBinds();
        //}

        /// <summary>
        ///删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvwUsers_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            sqlWhere = "delete from TempHumData  where Id='" + gvwUsers.DataKeys[e.RowIndex].Value.ToString() + "'";
            SimpleSqlserverHelper.ExecuteNonQuery(sqlWhere);
            dataBinds();
        }