protected void Button3_Click(object sender, EventArgs e)
{
//更改密码 SqlConnection myconn = new SqlConnection(ConfigurationManager.AppSettings["conStr"]); myconn.Open(); //打开数据库连接 string strPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(resetpassword.Text.Trim(), "md5"); string sqlstr = "update users set userpwd='" + strPwd + "' where username='" + username.Text + "'"; Response.Write(sqlstr); Response.End(); SqlCommand mycmd = new SqlCommand(sqlstr, myconn);//创建数据库命令 try
{ mycmd.ExecuteNonQuery(); Session["UserName"] = username.Text; Response.Write("<script language=javascript>alert('密码更改成功!');location.href='Default.aspx'</script>"); } finally
{ //关闭操作 myconn.Close(); } }
运行后,在IE上直接显示出:update users set userpwd='B59C67BF196A4758191E42F76670CEBA' where username='test',,哎,,不知道咋回事
{
//更改密码 SqlConnection myconn = new SqlConnection(ConfigurationManager.AppSettings["conStr"]); myconn.Open(); //打开数据库连接 string strPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(resetpassword.Text.Trim(), "md5"); string sqlstr = "update users set userpwd='" + strPwd + "' where username='" + username.Text + "'"; Response.Write(sqlstr); Response.End(); SqlCommand mycmd = new SqlCommand(sqlstr, myconn);//创建数据库命令 try
{ mycmd.ExecuteNonQuery(); Session["UserName"] = username.Text; Response.Write("<script language=javascript>alert('密码更改成功!');location.href='Default.aspx'</script>"); } finally
{ //关闭操作 myconn.Close(); } }
运行后,在IE上直接显示出:update users set userpwd='B59C67BF196A4758191E42F76670CEBA' where username='test',,哎,,不知道咋回事
解决方案 »
- 如果获取某个值所属类型的默认值,这个的值的类型是不确定的
- img标签问题
- 数据绑定+JS字符串拼接问题
- 有用过 Webb.WAVE.Controls.Upload2 这个上传组件的吗?
- 请教一个关于html代码的问题(有关javasrcipt的)
- 请教关于加载IE页面就直接打印页面内容的问题
- Lostinet最新作品 Lostinet.Web.ControlHelper 打造最方便的MessageBox,Dialog控件.
- 后台生成的url字符串里的<怎么被编码了,如何正常使用,mvc3视图代码
- 初学者的问题,别人的程序怎么在vs.net下调试
- 为什么ListBox1_SelectedIndexChanged没反应?马上结帖!谢谢
- OleDbParameter参数问题
- 求助各路英雄
这句就是输出,在IE上直接显示出:update users set userpwd='B59C67BF196A4758191E42F76670CEBA' where username='test'的原因。
Response.End(); 你都end了还改啥?
Response.End(); 去掉这句就可以了。