Here the code of Password change:-
public partial class Change_Password : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Data Source=abc;Initial Catalog=database name;
Integrated Security=True");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String str = "update reg set password=@password where u_name=@u_name";
cmd = new SqlCommand(str, con);
cmd.Parameters.AddWithValue("@email",t_uname.text);
cmd.Parameters.AddWithValue("@password", txt_nPW.Text);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
Response.Write("Hurrah!Password Changed Succesfully");
}
}
No comments:
Post a Comment