?? userlogin.aspx.cs
字號(hào):
?using System;
using System.Data;
using System.Data.SqlClient;
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 userlogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection conn = db.createconn();
conn.Open();
SqlCommand Cmd = new SqlCommand("select * from user1 where u_log='" + txtuser.Text + "' and u_pwd = '" + txtpwd.Text + "' ", conn);
SqlDataReader dr = Cmd.ExecuteReader();
if (txtuser.Text != "" && txtpwd.Text != "")
{
if (dr.Read())
{
Session["user"] = dr["u_name"].ToString();
Session["id"] = dr["u_id"].ToString();
Session["ok"] = "ok";
Response.Redirect("productadd.aspx");
}
else
{
Response.Write("<script>alert('您還不是注冊(cè)用戶或用戶名和密碼錯(cuò)誤,不能發(fā)布您的產(chǎn)品!');history.go(-1);</script>");
}
}
else
{
Response.Write("<script>alert('請(qǐng)輸入用戶名和密碼!');history.go(-1);</script>");
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -