📄 findpwd.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace HotelHome.user
{
/// <summary>
/// SqlPwd 的摘要说明。
/// </summary>
public class SqlPwd : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button OKButton;
protected System.Web.UI.WebControls.Label FindHeaderLabel;
protected System.Web.UI.WebControls.Label QuestionLabel;
protected System.Web.UI.WebControls.TextBox QuestionTextbox;
protected System.Web.UI.WebControls.Label AnswerLabel;
protected System.Web.UI.HtmlControls.HtmlTable FindPwdTable;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox AnswerTextbox;
DBService clcon;
DataRow row;
protected System.Web.UI.WebControls.LinkButton LinkButton1;
DataSet myds;
public void lnk_click(Object Src,EventArgs E)
{
Response.Redirect("Login.aspx");
}
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
//Session["memID"] = "aa";
clcon = new DBService();
string sqlstring = "select * from member";
myds = clcon.executeBySQL(sqlstring);
int num = myds.Tables[0].Rows.Count;
if(!this.IsPostBack)
{
if(num > 0)
{
for(int i=0; i < num; i++)
{
row = myds.Tables[0].Rows[i];
if(((string)row["memID"]).Equals(Session["memID"]))
{
QuestionTextbox.Text = (string)row["question"];
}
}
}
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.OKButton.Click += new System.EventHandler(this.OKButton_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void OKButton_Click(object sender, System.EventArgs e)
{
int num = myds.Tables[0].Rows.Count;
if(num > 0)
{
for(int i=0; i < num; i++)
{
row = myds.Tables[0].Rows[i];
if(((string)row["memID"]).Equals(Session["memID"]))
{
if(((string)row["answer"]).Equals(AnswerTextbox.Text))
{
Label1.Text = "你的密码:";
Label2.Text = (string)row["MemPwd"];
}
else
{
Response.Write("<script>alert('您的答案错误!请重新输入!');</script>");
return;
}
}
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -