userreg.aspx.cs

(完整代码) 1KB

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.OleDb;

public partial class userreg : System.Web.UI.Page
{
    DB dbobj = new DB(); Bind bind = new Bind(); comman com = new comman();
    protected void Page_Load(object sender, EventArgs e)
    {
        txtname.Focus();
    }
    protected void submit_Click(object sender, EventArgs e)
    {
        lblname.Text = "";
        if (txtname.Text != "" && txtpwd.Text != "")
        {
            OleDbConnection con0 = dbobj.GetConnection();
            con0.Open();
            string sql0 = "select * from hy where username='" + txtname.Text.Trim() + "'";
            OleDbCommand cmd0 = new OleDbCommand(sql0, con0);
            OleDbDataReader dr0 = cmd0.ExecuteReader();

            if (dr0.Read())
            {
                lblname.Text = "该用户名已存在!请换一个用户名";

            }
            else
            {
                string insertsql="insert into hy(username,pwd,realname,qq,email) values('"+txtname.Text.Trim()+"','"+txtpwd.Text.Trim()+"','"+txtrealname.Text.Trim()+"','"+txtqq.Text.Trim()+"','"+txtemail.Text.Trim()+"')";
                com.runsql(insertsql);
                lblname.Text = "注册成功!";
            }
            con0.Close();
        }
        else
        {
            Response.Write("<script language=javascript>alert('请输入用户名和密码!')</script>");
            
        }
    }
}

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

AI 解读 AI

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

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