Asp.net源码专业站
首页->商务办公->Asp.net简单会议事务系统>>adminchangpwd.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Asp.net简单会议事务系统
当前文件:文件类型 SimpleMeeting/adminchangpwd.aspx.cs[2K,2009-6-12 11:54:08]打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12 13public partial class adminchangpwd : System.Web.UI.Page 14{ 15 SqlConnection cn; 16 SqlDataReader dr; 17 protected void Page_Load(object sender, EventArgs e) 18 { 19 if (!Page.IsPostBack) 20 { 21 this.Labadminname.Text = Convert.ToString(Session["username"]); 22 } 23 } 24 protected void Button2_Click(object sender, EventArgs e) 25 { 26 if (Page.IsValid) 27 { 28 try 29 { 30 int id = Convert.ToInt32(Session ["id"]); 31 cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["cn"]); 32 cn.Open(); 33 SqlCommand cmd1 = new SqlCommand("select * from userinfo where username='" + this.Labadminname.Text.ToString().Trim() + "' and pwd='" + this.txtpwd.Text.ToString().Trim() + "'", cn); 34 dr = cmd1.ExecuteReader(); 35 if (dr.Read()) 36 { 37 Session["id"] = dr["id"]; 38 Session["username"] = dr["username"].ToString().Trim(); 39 Session["pwd"] = dr["pwd"].ToString(); 40 dr.Close(); 41 42 SqlCommand cmd = new SqlCommand("update userinfo set pwd='" + this.txtnewpwd.Text.ToString().Trim() + "' where id='"+id+"' and username='"+this.Labadminname .Text .Trim ()+"'", cn); 43 cmd.ExecuteNonQuery(); 44 this.Labmessage.Text = "修改用户密码成功"; 45 } 46 else 47 { 48 this.Labmessage.Text = "旧密码输入错误!"; 49 } 50 } 51 catch 52 { 53 this.Labmessage.Text = "服务器忙,请一会在试!"; 54 } 55 finally 56 { 57 cn.Close(); 58 } 59 } 60 } 61 protected void Button1_Click(object sender, EventArgs e) 62 { 63 this.txtnewpwd.Text = ""; 64 this.txtnewpwdagina.Text = ""; 65 this.txtpwd.Text = ""; 66 this.txtpwd.Focus(); 67 this.Labmessage.Text = ""; 68 69 } 70} 71
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Asp.net简单会议事务系统
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146