?? login.aspx.cs
字號(hào):
?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.SqlClient;
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//綁定用戶類型
if (!this.IsPostBack)
{
//SqlConnection con = DB.createConnection();
//con.Open();
//SqlCommand cmd = new SqlCommand("Select * from userclass",con);
//SqlDataReader sdr = cmd.ExecuteReader();
//this.peoclass.DataSource = sdr;
//this.peoclass.DataTextField = "用戶類型";
//this.peoclass.DataValueField = "用戶類型編號(hào)";
//this.peoclass.DataBind();
//sdr.Close();
}
//關(guān)閉窗口;
this.btnqx.Attributes.Add("onclick", "window.close()");
}
protected void btndl_Click(object sender, EventArgs e)
{
//驗(yàn)證用戶
string username = Request["username"];
string userpwd = Request["userpwd"];
SqlConnection con = new SqlConnection("server=.;database=shop;uid=sa;pwd=;");
con.Open();
SqlCommand cmd = new SqlCommand("select count(*) from login where 用戶名='" + username + "'and 用戶密碼='" + userpwd + "'", con);
int count = Convert.ToInt32(cmd.ExecuteScalar());
if (count > 0)
{
Response.Redirect("main.aspx");
}
else
{
Response.Write("<script>alert('用戶名或者密碼錯(cuò)誤,請(qǐng)重新輸入!');</script>");
return;
}
}
protected void btnqx_Click(object sender, EventArgs e)
{
}
protected void peoclass_TextChanged(object sender, EventArgs e)
{
}
protected void peoclass_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void userpwd_TextChanged(object sender, EventArgs e)
{
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -