📄 admin.aspx.cs
字号:
using System;
using System.Data;
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;
using System.Data.OleDb;
public partial class admin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("book.mdb");
OleDbConnection con = new OleDbConnection(strCon);
OleDbCommand cmd = con.CreateCommand();
cmd.CommandText = "select * from admin";
con.Open();
OleDbDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if (TextBox1.Text.ToString() == dr["user"].ToString() && TextBox2.Text.ToString() == dr["pwd"].ToString())
Response.Redirect("bookinsert.aspx");
else Response.Write("登录失败,请检查您的用户名及密码!");
}
con.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("login.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -