⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userlogin.aspx.cs

📁 成绩管理系统
💻 CS
字号:
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;

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

        DataBase DbOper = new DataBase();
        if (this.TextBox_UserName.Text.IndexOf("'") > 0 || this.TextBox_UserName.Text.IndexOf("-") > 0)
        {
            this.Label_Msg.Text = "用户名中有非法字符";
            return;
        }

        string Condition = "where UserName='" + this.TextBox_UserName.Text.Trim() + "' and UserPass='" + this.TextBox_UserPass.Text + "' and UserType='" + this.DropDownList1.SelectedValue.ToString() + "'";

      DataSet Dset = DbOper.BindGrid("User_Info", "*", Condition, "");
      if (Dset != null && Dset.Tables[0].Rows.Count > 0)
      {
          Session["UserType"] = this.DropDownList1.SelectedValue.ToString();
          Session["UserName"] = this.TextBox_UserName.Text;
         // Response.Redirect("AddCourse.aspx");
          this.Label_Msg.Text = "登录成功!";
          Response.Write("<meta http-equiv=refresh ; content='2;URL=QueryGrade.aspx'>");
          
      }
      else
      {
          this.Label_Msg.Text = "登录失败!";
          this.TextBox_UserName.Text = "";
          this.TextBox_UserPass.Text = "";

 
      }
    }

    protected void Button_Cancel_Click(object sender, EventArgs e)
    {
        this.TextBox_UserName.Text = "";
        this.TextBox_UserPass.Text = "";
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -