asp.net修改密码
修改密码的核心代码?请给力指导,谢谢 --------------------编程问答-------------------- 神马情况?插入数据库,修改数据库? --------------------编程问答-------------------- 修改数据库 表里的密码?那直接用update语句啊 --------------------编程问答-------------------- 最好在存储过程中做,检查原密码是否正确,新密码是否确认相同。--------------------编程问答-------------------- asp里德功能实现代码,谢谢 --------------------编程问答--------------------
--------------------编程问答--------------------
public static bool UpdateInfo(string name, string pwd)
{
bool b = false;
string sql = "Update AdminInfo Set passwd='"+pwd+" ' where name='" + name + "'";
try
{
SqlCommand com = new SqlCommand(sql, sqlConn);
sqlConn.Open();
int i = (Int32)com.ExecuteNonQuery();
if (i > 0)
{
b = true;
}
}
catch (Exception ex) { }
finally
{
sqlConn.Close();
}
return b;
}
--------------------编程问答-------------------- LZ你是不是蛋疼了 --------------------编程问答-------------------- lz你的需求不明确啊· --------------------编程问答-------------------- public static bool UpdateInfo(string name, string pwd)
string password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txt_OldPwd.Text, "MD5");
string sql = "Select Top 1 * From Manager where UserName=@UserName and password=@password";
string[] strParam1 ={ "@UserName", "@password" };
object[] strValue1 ={ Session["MUserName"], password };
if (!db.SearchTable(sql, strParam1, strValue1))
{
ScriptManager.RegisterStartupScript(up1,typeof(UpdatePanel), "d", "alert('错误:旧密码输入不正确!');",true);
return;
}
password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txt_NewPwd1.Text, "MD5");
sql = "Update Manager Set Password='" + password + "' Where UserName='" + Session["MUserName"] + "'";
if (db.ExecuteUpdate(sql))
{
ScriptManager.RegisterStartupScript(up1, typeof(UpdatePanel), "d", "alert('密码变更成功!');", true);
return;
}
else
{
ScriptManager.RegisterStartupScript(up1, typeof(UpdatePanel), "d", "alert('密码变更失败!');", true);
return;
}
{
bool b = false;
string sql = "Update AdminInfo Set passwd='"+pwd+" ' where name='" + name + "'";
try
{
SqlCommand com = new SqlCommand(sql, sqlConn);
sqlConn.Open();
int i = (Int32)com.ExecuteNonQuery();
if (i > 0)
{
b = true;
}
}
catch (Exception ex) { }
finally
{
sqlConn.Close();
}
return b;
}
补充:.NET技术 , ASP.NET