Forget Password

Saranya Boopathi
Posted by Saranya Boopathi under C# category on | Points: 40 | Views : 758
Forget Password is getting while give your mobile Number:

 protected void Button1_Click(object sender, EventArgs e)
{
setconnectionstring();
SqlConnection con = new SqlConnection(str);
SqlDataReader dr;
con.Open();
SqlCommand cmd = new SqlCommand("select [Mobile No] from login where username='" + TextBox1.Text + "'", con);
dr = cmd.ExecuteReader();

if (!dr.Read())
{
Label4.Text = ("Wrong Username");
}
else if (dr[0].ToString().Trim() == TextBox2.Text.Trim())
{
con.Close();
con.Open();
SqlCommand cmd1 = new SqlCommand("select password from login where username='" + TextBox1.Text + "'", con);
Label3.Text = cmd1.ExecuteScalar().ToString();
Button2.Visible = true;
Button1.Visible = false;
con.Close();
}
else
{
Label5.Text = ("Wrong Mobile No");
}
}

Comments or Responses

Login to post response