温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:智能选课系统源码及论坛
当前文件路径:XuanKeLunWen/Admin/AdminLogin.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
public partial class Admin_AdminLogin : System.Web.UI.Page 13
{ 14
protected void Page_Load(object sender, EventArgs e) 15
{ 16
17
} 18
private void login() 19
20
{//判断登录用户 21
22
OleDbConnection con = db.con(); 23
con.Open(); 24
OleDbCommand cmd = new OleDbCommand("select * from Admin where Aname='" + this.TextBox1.Text + "'and Apwd='"+this.TextBox2.Text+"'", con); 25
OleDbDataReader sdr = cmd.ExecuteReader(); 26
if (sdr.Read()) 27
{ 28
Session["aname"] = sdr["Aname"].ToString(); 29
30
Response.Write("<script language='javascript'>alert('登录成功欢迎使用本选课系统');location.href='../Admin/Index.aspx'</script>"); 31
32
} 33
else 34
{ 35
36
Response.Write("<script language='javascript'>alert('用户名户密码错误请重新登录');location.href='../Admin/AdminLogin.aspx'</script>"); 37
38
39
} 40
} 41
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) 42
{ 43
login(); 44
45
} 46
47
48
protected void ImageButton2_Click(object sender, ImageClickEventArgs e) 49
{ 50
this.TextBox1.Text = ""; 51
this.TextBox2.Text = ""; 52
this.TextBox3.Text = ""; 53
} 54
} 55





}
}