📄 admin.aspx.cs
字号:
using System;
using System.Data;
using System.Data.OleDb;
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 admin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void submit_Click(object sender, EventArgs e)
{
OleDbConnection oleConnection = new OleDbConnection(ConfigurationManager.AppSettings["ConnectionString"].ToString() + System.Web.HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["dpPath"]).ToString() + ";");
OleDbCommand oleCommand = new OleDbCommand("select * from db_Admin where admin_Name='" + name.Text.Trim() + "' AND '" + pass.Text.Trim() + "'", oleConnection);
oleConnection.Open();
try
{
if (oleCommand.ExecuteScalar() != null)
{
Session["name"] = this.name.Text.ToString();
Session["passWord"] = this.pass.Text.ToString();
Response.Redirect("Score.aspx");
}
else
{
Response.Write("<script>alert('用户名或密码错误');location='admin.aspx';</script>");
}
}
catch (Exception ex)
{
throw (ex);
}
finally
{
oleCommand.Dispose();
oleConnection.Close();
}
}
protected void reset_Click(object sender, EventArgs e)
{
name.Text = "";
pass.Text = "";
CheckCode.Text = "";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -