?? user_open.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 System_user : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Session["username"]) == "")
{
Response.Write("<script language=javascript>alert('請登錄');location='../login.aspx'</script>");
}
if (!IsPostBack)
{
SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
strcon.Open();
SqlCommand scd = new SqlCommand("select username from tb_User where id="+Request["id"],strcon);
this.username.Text = Convert.ToString(scd.ExecuteScalar()); ;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
stockClass sc = new stockClass();
if (sc.validate(Request["userpwd"].ToString()))
{
Response.Write("<script>alert('密碼中不能含有非法字符');history.back()</script>");
Response.End();
}
SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
strcon.Open();
SqlCommand scd = new SqlCommand("update tb_user set userpwd='"+Request["userpwd"]+"',AddTime='"+DateTime.Now+"' where id='" +Request["id"] + "'", strcon);
scd.ExecuteNonQuery();
strcon.Close();
Response.Write("<script>alert('密碼修改成功');opener.location='user_manage.aspx';window.close()</script>");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -