admin.aspx.cs
来自「简单的系统评分源代码」· CS 代码 · 共 56 行
CS
56 行
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 + =
减小字号Ctrl + -
显示快捷键?