📄 relogin.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 relogin : System.Web.UI.Page
{
public void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection();
con.ConnectionString = "provider=Microsoft.Jet.OlEDB.4.0;data source=" + Server.MapPath("~/BDB/BookStore.mdb");
con.Open();
Label1.Text = con.State.ToString();
string username = this.TextBox1.Text;
string userpwd = this.TextBox2.Text;
string access = "select * from maneger where name='" + username + "'and password='" + userpwd + "'";
OleDbCommand Comm = new OleDbCommand(access,con);
OleDbDataReader dr = Comm.ExecuteReader();
if (dr.Read()) {
Response.Redirect("Default.aspx");
}
else{
Response.Write("<script>alert('用户名或密码错误');</script>");
}
con.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox2.Text = "";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -