Register.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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 MyMD5
{
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        //检查用户是否存在
        protected void linbtnCheck_Click(object sender, EventArgs e)
        {
            int reValue = CheckName();
            if (reValue == -1)
            {
                Response.Write("<script>alert('用户名已存在!')</script>");
                this.txtUserName.Focus();
            }
            else if (reValue==2)
            {
                Response.Write("<script>alert('恭喜您,该用户可以使用!')</script>");
                this.txtUserName.Focus();
            }
        }
        //验证用户是否存在
        public int CheckName()
        {
            DB db = new DB();
            string str = "select COUNT(*) from tb_User where UserName='" + this.txtUserName.Text.Trim() + "'";
            try
            {
                DataTable dt = db.reDt(str);
                if (dt.Rows[0][0].ToString() != "0")
                {
                    return -1;//用户名已存在
                }
                else 
                {
                    return 2;//用户名可以用
                }
            }
            catch (Exception e)
            {
                return 0;
            }
        }
        //注册
        protected void btnOk_Click(object sender, EventArgs e)
        {
            int reValue = CheckName();
            if (reValue == -1)
            {
                Response.Write("<script>alert('用户名已存在!')</script>");
后面还有 38 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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