user_forget.aspx.cs

来自「网站开发与实例,提供完整的电子商务网站源代码。」· CS 代码 · 共 36 行

CS
36
字号
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 user_forget : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
        strcon.Open();
        SqlCommand scd = new SqlCommand("select Userpwd from tb_User where Username='"+this.username.Text.ToString()+"' and Email='"+this.email.Text.ToString()+"' and Problem='"+this.problem.Text.ToString()+"' and Answer='"+this.answer.Text.ToString()+"'",strcon);
        string userpwd = Convert.ToString(scd.ExecuteScalar());
        if (userpwd != "")
        {
            this.Label1.Text = "您的密码是:<font color=red>" + userpwd+"</font>";
        }
        else
        {
            this.Label1.Text = "<font color=red>对不起,请输入的条件有误</font>";
        }
        strcon.Close();
    }
}

⌨️ 快捷键说明

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