reg.aspx.cs

来自「购物车主要是为广大网上顾客购物的资源平台。购物车主要目标是建设在网上对用户进行信」· CS 代码 · 共 44 行

CS
44
字号
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 System.Data.SqlClient;

public partial class Reg : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Btn_res_Click(object sender, EventArgs e)
    {
        this.Tbx_phone.Text = "";
        this.Tbx_pwd.Text = "";
        this.Tbx_pwda.Text = "";
        this.Tbx_uane.Text = "";
    }
    protected void Btn_sub_Click(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString);
        conn.Open();
        string str = "insert into Userlist (Uname,Upwd,Uphone) values ('"+this.Tbx_uane.Text+"','"+this.Tbx_pwd.Text+"','"+this.Tbx_phone.Text+"')";
        SqlCommand cmd=new SqlCommand (str,conn);
        if(cmd.ExecuteNonQuery()>0)
        {
            Response.Write("<script> alert('恭喜,注册成功!');</script>");
            Response.Redirect("Default.aspx");
        }
        else
        {
            Response.Write("<script>alert('注册失败,请重新注册!');</script>");
        }
        conn.Close();
    }
}

⌨️ 快捷键说明

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