Exemplo n.º 1
0
        private void changeButton_Click(object sender, EventArgs e)
        {
            DataSet ds  = pD.getPassword();
            string  old = ds.Tables[0].Rows[0]["password"].ToString();

            if (oldBox.Text == old)
            {
                if (newBox.Text == confirmBox.Text)
                {
                    p = new passwordDTO(newBox.Text);
                    pD.updatePassword(p);
                    oldBox.Text     = "";
                    newBox.Text     = "";
                    confirmBox.Text = "";
                    MessageBox.Show("Password Changed !");
                }
                else
                {
                    MessageBox.Show("Passwords not matched !");
                }
            }
            else
            {
                MessageBox.Show("Incorrect password !");
            }
        }
Exemplo n.º 2
0
        public void updatePassword(passwordDTO p)
        {
            s.sqlConnection.Open();
            string query = "update passwords set password = '******' where userName = '******'";

            s.sqlCommand = new SqlCommand(query, s.sqlConnection);
            s.sqlCommand.ExecuteNonQuery();
            s.sqlConnection.Close();
        }