本文将给出通过C#编程来实现 忘记密码 功能的方法和代码,大家可以参照本文的思路自己写出这个功能代码……
以下是引用片段:
int result = user.GetBackPassword(LoginName.Text.Trim(), Question.Text.Trim(),
Answer.Text.Trim(), Email.Text);
if (result == 1)
{
Message.Text = "您的密码已发送,请到邮箱查收";
//user.ChangePassword(
}
else
{
Message.Text = "您的输入信息有误!";
}
public int GetBackPassword(string userName, string question, string answer, string email)
{
object m_DBNull = Convert.DBNull;
//获得新的随机密码
string newPassword = MakePassword(6);
//定义存储过程参数
SqlParameter[] para = {
new SqlParameter("@userName", userName),
new SqlParameter("@question", question),
new SqlParameter("@answer", answer),
new SqlParam