⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userlogin.aspx.cs

📁 大中型酒店管理系统
💻 CS
字号:
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('您还不是注册用户或用户名和密码错误,不能发布您的产品!');history.go(-1);</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('请输入用户名和密码!');history.go(-1);</script>");
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -