📄 st_updatepwd.aspx.cs
字号:
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 ST_updatepwd : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void st_btn_upst_date_Click(object sender, EventArgs e)
{
string st_connstr = ConfigurationManager.AppSettings["st_dbconn"];
SqlConnection st_conn = new SqlConnection(st_connstr);
st_conn.Open();
string st_sqlstr = "select * from ST_users where ST_User_id='" + st_tbx_id.Text + "'and ST_User_password='" + st_tbx_beforepwd.Text + "'";
SqlCommand st_comm = new SqlCommand(st_sqlstr, st_conn);
SqlDataReader st_dreader = st_comm.ExecuteReader();
if (st_dreader.Read())
{
st_pnl_update.Visible = true;
st_pn_user.Visible = false;
st_lbl_note.Text = "";
}
else
{
st_lbl_note.Text = "无此用户或者密码不对";
}
}
protected void st_btn_ok_Click(object sender, EventArgs e)
{
string st_connstr = ConfigurationManager.AppSettings["st_dbconn"];
SqlConnection st_conn = new SqlConnection(st_connstr);
st_conn.Open();
string st_sqlstr = "update ST_users set ST_User_password='" + st_tbx_newpwd.Text + "' where ST_User_id='" + st_tbx_id.Text + "'";
SqlCommand st_comm = new SqlCommand(st_sqlstr, st_conn);
try
{
st_comm.ExecuteNonQuery();
st_lbl_note.Text = "修改成功!";
}
catch (SqlException)
{
st_lbl_note.Text = "修改有误!";
st_pn_user.Visible = true;
}
st_conn.Close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -