温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:智能选课系统源码及论坛
当前文件路径:XuanKeLunWen/student/StudentLogin.aspx.cs

1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using System.Data.OleDb; 12
13
public partial class StudentLogin : System.Web.UI.Page 14
{ 15
protected void Page_Load(object sender, EventArgs e) 16
{ 17
18
} 19
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) 20
{ 21
login(); 22
} 23
private void login() 24
25
{//判断登录用户 26
27
OleDbConnection con = db.con(); 28
con.Open(); 29
OleDbCommand cmd = new OleDbCommand("select * from Student where Sname='" + this.TextBox1.Text + "'and Spwd='"+this.TextBox2.Text+"'", con); 30
OleDbDataReader sdr = cmd.ExecuteReader(); 31
if (sdr.Read()) 32
{ 33
Session["sname"] = sdr["Sname"].ToString(); 34
Session["zhuanye"] = sdr["Szhuanye"].ToString(); 35
36
Response.Write("<script language='javascript'>alert('登录成功欢迎使用本选课系统');location.href='../student/StudentIndex.aspx'</script>"); 37
38
} 39
else 40
{ 41
42
Response.Write("<script language='javascript'>alert('用户名户密码错误请重新登录');location.href='../student/StudentLogin.aspx'</script>"); 43
44
45
} 46
} 47
48
} 49





}
}