login.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.SqlClient;
using System.Configuration;
using System.Data;

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

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string ConnStr1 = System.Configuration.ConfigurationManager.ConnectionStrings["ConnStr"].ToString();
        SqlConnection cn = new SqlConnection(ConnStr1);
        // cn.ConnectionString = ConnStr1;
        String sql = "select count(*) from UserInfo where UserInfo.Name='"+TextBox1.Text+"' and UserInfo.Password='"+TextBox2.Text+"'";
        SqlCommand cmd = new SqlCommand(sql, cn);

        cn.Open();
        int count = (int)cmd.ExecuteScalar();
        Response.Write(count.ToString());
        if (count == 1)
        {
            cn.Close();
            Response.Write("ok!!");
            string s = TextBox1.Text.Trim();
            Response.Redirect("Welcome.aspx?Name=" + s);
        }
        else
        {
            Response.Write("用户名或密码不正确请重新输入!!");
        }

    }
}

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

AI 解读 AI

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

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