AddUser.aspx.cs

(完整代码) 2KB

using System;
using System.Data;
using System.Data.SqlClient;
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;

public partial class AddUser : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // 下载于www.51aspx.com
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string str1="insert into Users(UID,UPassword,UPower,UName,USex,UAddress,UTel,UEmail,UDep) values ('" + TextBox1.Text + "',' 123  ','" + DropDownList1.Text + "','" + TextBox3.Text + "', '男' ,'" + TextBox7.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + DropDownList2.Text + "')";
        string str2="insert into Users(UID,UPassword,UPower,UName,USex,UAddress,UTel,UEmail,UDep) values ('" + TextBox1.Text + "',' 123  ','" + DropDownList1.Text + "','" + TextBox3.Text + "', '女' ,'" + TextBox7.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + DropDownList2.Text + "')";
        SqlConnection con = WMS.createCon();
        con.Open();
        if (RadioButton1.Checked == true)
        {
            SqlCommand cmd = new SqlCommand(str1, con);
            cmd.ExecuteNonQuery();
            con.Close();
            Response.Write("<script language='javascript'>alert('人员信息信息添加成功!');</script>");
            TextBox1.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
            TextBox5.Text = "";
            TextBox7.Text = "";
        }
        else if (RadioButton2.Checked == true)
        {
            SqlCommand cmd = new SqlCommand(str2, con);
            cmd.ExecuteNonQuery();
            con.Close();
            Response.Write("<script language='javascript'>alert('人员信息添加成功!');</script>");
            TextBox1.Text = "";
            TextBox3.Text = "";
            TextBox4.Text = "";
            TextBox5.Text = "";
            TextBox7.Text = "";
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox1.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = ""; 
        TextBox5.Text = ""; 
        TextBox7.Text = "";
        RadioButton1.Checked = false;
        RadioButton2.Checked = false;
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。