展开全部
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;
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Attributes.Add("style", "background-color:transparent");
TextBox2.Attributes.Add("style", "background-color:transparent");
if (Request["p"]!=null)
{
Session["usr"] = null;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
ConnDbForAcccess conn = new ConnDbForAcccess();
DataSet ds = conn.ReturnDataSet("select * from login where usr= '" + TextBox1.Text + "' and pawd='" + TextBox2.Text + "'");
if (ds.Tables[0].Rows.Count > 0)
{
Session["usr"] = ds.Tables[0].Rows[0]["usr"];
Response.Redirect("Default.aspx");
}
else
Stringdis.Show_Msg("用户名或密码错误!");
}
protected void Button2_Click(object sender, EventArgs e)
{
}
}
因为能读懂吧?数据库不用我帮你建吧?
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;
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Attributes.Add("style", "background-color:transparent");
TextBox2.Attributes.Add("style", "background-color:transparent");
if (Request["p"]!=null)
{
Session["usr"] = null;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
ConnDbForAcccess conn = new ConnDbForAcccess();
DataSet ds = conn.ReturnDataSet("select * from login where usr= '" + TextBox1.Text + "' and pawd='" + TextBox2.Text + "'");
if (ds.Tables[0].Rows.Count > 0)
{
Session["usr"] = ds.Tables[0].Rows[0]["usr"];
Response.Redirect("Default.aspx");
}
else
Stringdis.Show_Msg("用户名或密码错误!");
}
protected void Button2_Click(object sender, EventArgs e)
{
}
}
因为能读懂吧?数据库不用我帮你建吧?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询