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