当前位置:编程学习 > C#/ASP.NET >>

C(#) asp.net修改密码

请教高手指教 怎么修改密码:我用的是Linq 连接数据库,下面是我在修改按钮上写的代码,请教 是在哪里出错 修改不了? protected void Button1_Click(object sender, EventArgs e) { if (Session["username"]!=null) { myUserDataContext context = new myUserDataContext(); var p = ""; var q = from o in context.UserInfoTable select new { p=o.UserPwd }; if (TextBox1.Text!=p) { RequiredFieldValidator1.ErrorMessage = "原始密码不正确!"; //Response.Write("<script>alert('原始密码不正确')</script>"); } else { myUserDataContext db = new myUserDataContext(); UserInfoTable ui = new UserInfoTable(); ui.UserPwd = TextBox2.Text; db.UserInfoTable.InsertOnSubmit(ui); db.SubmitChanges(); Response.Write("<script>alert('恭喜你修改密码成功')</script>"); Response.Redirect("Default.aspx"); } } else { Response.Redirect("UserLogin.aspx"); } }
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,