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

📄 studentlogin.aspx.cs

📁 C#+ACCESS在线选课系统的设计与实现
💻 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;
using System.Data.OleDb;

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

    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        login();
    }
    private void login()
   
    {//判断登录用户
       
        OleDbConnection con = db.con();
        con.Open();
        OleDbCommand cmd = new OleDbCommand("select  * from  Student    where Sname='" + this.TextBox1.Text + "'and Spwd='"+this.TextBox2.Text+"'", con);
        OleDbDataReader sdr = cmd.ExecuteReader();
        if (sdr.Read())
        {
            Session["sname"] = sdr["Sname"].ToString();
            Session["zhuanye"] = sdr["Szhuanye"].ToString();

            Response.Write("<script language='javascript'>alert('登录成功欢迎使用本选课系统');location.href='../student/StudentIndex.aspx'</script>");

        }
        else 
        {

            Response.Write("<script language='javascript'>alert('用户名户密码错误请重新登录');location.href='../student/StudentLogin.aspx'</script>");

        
        }
    }

}

⌨️ 快捷键说明

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