add_users.aspx.cs

来自「程序学生信息管理系统(SQL2000+ASP.NET+c#+)」· CS 代码 · 共 48 行

CS
48
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SMS;

public partial class add_Users : System.Web.UI.Page
{
    OPDataBase op = new OPDataBase();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string sql = "insert  into Users (UserName,Password,Power)values('" + TextBox1_name.Text + "','" + PassWord_box.Text + "','" + RadioButtonList1.SelectedValue.ToString() + "')";
        if (PassWord_box.Text!="" && TextBox1_name.Text != "")
        {
            try
            {
                op.BindCommand (sql);
                Response.Write("<script>alert('成功!')</script>");
            }
            catch
            {
                Response.Write("<script>alert('失败!')</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('用户名和密码不能为空!')</script>");
           
        
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox1_name.Text = "";
        PassWord_box.Text = "";
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?