温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:在线订票系统源码(毕业设计)
当前文件路径:TicketOnline/login.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.SqlClient; 12
13
public partial class login : System.Web.UI.Page 14
{ 15
protected void Page_Load(object sender, EventArgs e) 16
{ 17
18
} 19
protected void btclier_Click(object sender, EventArgs e) 20
{ 21
this.txtname.Text = ""; 22
this.txtpwd.Text = ""; 23
} 24
protected void btnlogin_Click(object sender, EventArgs e) 25
{ 26
SqlConnection con = db.ceratcon(); 27
con.Open(); 28
SqlCommand cmd = new SqlCommand("select * from Admin where Aname='" + this.txtname.Text + "'and Apwd='" + this.txtpwd.Text + "'", con); 29
SqlDataReader sdr = cmd.ExecuteReader(); 30
if (sdr.Read()) 31
{ 32
Session["Aname"] = sdr["Aname"].ToString(); 33
Session["Apw"] = sdr["Apw"].ToString(); 34
Response.Write("<script language='javascript'>alert('登录成功欢迎使用web售票系统');location.href='Index.aspx'</script>"); 35
36
} 37
38
else 39
{ 40
Response.Write("<script language='javascript'>alert('用户名或密码错误请重新登录');location.href='login.aspx'</script>"); 41
42
} 43
} 44
} 45





}
}