Beispiel #1
0
        private void forgetpassword_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            welcome w = new welcome();

            w.Show();
        }
Beispiel #2
0
      private void resetpassb2_Click(object sender, EventArgs e)
      {
          try
          {
              int i = 0;
              con.Open();
              SqlDataAdapter sda = new SqlDataAdapter(@"SELECT [id]  ,[firstname],[lastname],[username],[password]
     ,[contact]
 FROM [dbo].[registration] where username='******' and contact='" + t2.Text + "' ", con);
              DataTable      dt  = new DataTable();
              sda.Fill(dt);
              con.Close();
              i = Convert.ToInt32(dt.Rows.Count.ToString());
              if (t1.Text == "" || t2.Text == "" || t3.Text == "" || t4.Text == "")
              {
                  MessageBox.Show("Please fill all the details.");
              }
              else if (i == 0)
              {
                  MessageBox.Show("Username or contact does not match...!");
              }
              else
              {
                  if (t3.Text != t4.Text)
                  {
                      MessageBox.Show("Password does not matched");
                  }
                  else if (passwordexp(t3.Text) == false)
                  {
                      MessageBox.Show("Password must contain  8 to 15 characters,a-z,A-Z,0-9");
                  }
                  else
                  {
                      con.Open();
                      SqlCommand cmd = new SqlCommand(@"UPDATE [dbo].[registration]
 SET [password] = '" + t3.Text + "' WHERE  username= '******' and contact='" + t2.Text + "' ", con);
                      cmd.ExecuteNonQuery();
                      con.Close();
                      MessageBox.Show("Record Updated Successfully!!");
                      this.Hide();
                      welcome w = new welcome();
                      w.Show();
                  }
              }
          }
          catch (Exception ex)
          {
              MessageBox.Show("Error", ex.Message);
          }
      }