WebSite1/zhuche.aspx.cs

(完整代码) 2KB

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

    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        string STconnection = ConfigurationSettings.AppSettings["strconnection"];
        string SQL1 = "select User_Name from JianLi_User where User_Name='"+TextBox1 .Text +"'";
        string StrSql = "insert into JianLi_User (User_Name,User_Age,User_Password,User_Sex,Person_Name,AllowAdmin,User_Mobine,Email,Address) values('"+TextBox1 .Text +" ','"+TextBox4 .Text +"','"+TextBox3 .Text +"','"+strSex .Text  +"','"+TextBox2 .Text +"','0','"+TextBox6 .Text +"','"+TextBox7 .Text +"','"+TextBox8 .Text +"')";
        SqlConnection Strconn = new SqlConnection(STconnection);  
        try
         {
                Strconn.Open();
                SqlCommand StrCmdSe=new SqlCommand (SQL1 ,Strconn );
                SqlDataReader reader= StrCmdSe.ExecuteReader ();        
            if(!reader.Read () )
            {
                try
                {
                    reader.Close();
                    SqlCommand StrCmd = new SqlCommand(StrSql, Strconn);
                    StrCmd.ExecuteNonQuery();
                    Label1.Text = "注册成功";
                    Label1.Visible = true;
                }
                catch (Exception e2) { Response.Write(e2);}
            }
            else { Response.Write("<script language='javascript'>alert('用户名已被占用!');</script>"); }
        }
        catch (Exception e1)
        {
            System.Console.WriteLine(e1);
        }
        finally
        {
            Strconn.Close();
           
        }            
      }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("../WebSite1/login.aspx");
    }
}

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

AI 解读 AI

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

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