adlogin.aspx.cs
来自「ASP.net+Access数据库源码数据库源码」· CS 代码 · 共 44 行
CS
44 行
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 adlogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.Tbuser.Text = "";
this.Tbpwd.Text = "";
}
}
protected void btnok_Click(object sender, EventArgs e)
{
OleDbConnection con = DB.mycon();
con.Open();
string sql = "select * from UserTable where UserName='"+Tbuser.Text.Trim()+"' and UserPwd='"+Tbpwd.Text.Trim()+"'";
OleDbCommand cmd = new OleDbCommand(sql, con);
OleDbDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
Response.Redirect("index.htm");
}
else
{
this.labmessage.Text = "登录失败";
}
}
protected void btncansel_Click(object sender, EventArgs e)
{
Response.Redirect("Default.aspx");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?