private void btnSearch_Click(object sender, EventArgs e)
        {
            if (TxtPasswordConfirm.Text == "")
            {
                MessageBox.Show("Password did not match", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                TxtPasswordConfirm.Focus();
            }
            else if (TxtPassword.Text == "")
            {
                MessageBox.Show("Password did not match", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                TxtPasswordConfirm.Focus();
            }
            else if (TxtPasswordConfirm.Text != TxtPassword.Text)
            {
                MessageBox.Show("Password did not match", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                TxtPasswordConfirm.Focus();
            }
            else
            {
                string StringReturn = "";


                SqlConnection con = new SqlConnection(conStr);
                SqlCommand    cmd = new SqlCommand();
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.CommandText = "TRAN_UpdatePassword";
                cmd.Parameters.Add("@UserPassword", SqlDbType.VarChar, -1).Value = TxtPassword.Text.ToString();
                cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = Convert.ToInt32(TxtUserID.Text.ToString());


                cmd.Connection = con;
                try
                {
                    con.Open();
                    cmd.ExecuteNonQuery();

                    this.Dispose();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    con.Close();
                    con.Dispose();
                }
            }
        }
示例#2
0
 private void TxtPasswordNew_KeyUp(object sender, KeyEventArgs e)
 {
     switch (e.KeyCode)
     {
     case Keys.Enter:
     {
         TxtPasswordConfirm.SelectAll();
         TxtPasswordConfirm.Focus();
         break;
     }
     }
 }