relogin.aspx.cs

来自「visual stdio 2005」· CS 代码 · 共 53 行

CS
53
字号
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 + =
减小字号Ctrl + -
显示快捷键?