reg.aspx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace 电子商务
{
    public partial class reg : System.Web.UI.Page
    {
        SQLHelper db = new SQLHelper();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string username = this.txt_username.Text.ToString();
            string password = this.txt_password.Text.ToString();
            string name = this.txt_name.Text.ToString();
            string phone = this.txt_phone.Text.ToString();
            string email = this.txt_email.Text.ToString();
            string sex = this.rbt_sex.SelectedValue.ToString();
            string addr = this.txt_addr.Text.ToString();
            //判断是否账号重复
            string q = "select * from hy where username='" + username + "'";
            DataTable d = db.ExecuteQuery(q, CommandType.Text);
            if (d.Rows.Count != 0)
            {
                Response.Write("<script>alert('该帐号已经存在,请重新输入!');location='reg.aspx'</script>");
            }
            else
            {
                string sql = "insert into hy(username,password,name,phone,email,sex) values('" + username + "','" + password + "','" + name + "','" + phone + "','" + email + "','" + sex + "')";
                int r = db.ExecuteNonQuery(sql, CommandType.Text);
                Response.Write("<script>alert('注册成功!');location='index.aspx'</script>");
            }
            Response.Write("<script>alert('注册成功!');location='index.aspx'</script>");
        }
    }
}

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

AI 解读 AI

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

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