Esempio n. 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            myDatabase    db  = new myDatabase();
            SqlConnection con = new SqlConnection(db.con);
            String        sql = "select * from taikhoan where username = '******'and password ='******'";

            con.Open();
            Save_Data();
            SqlCommand    cmd = new SqlCommand(sql, con);
            SqlDataReader rd  = cmd.ExecuteReader();

            if (rd.Read() == true)
            {
                this.Hide();
                Form1 m = new Form1();
                m.Show();
            }
            else
            {
                MessageBox.Show("Đăng nhập không thành công");
                txtPass.Text  = "";
                txtUsers.Text = "";
                txtUsers.Focus();
            }
        }
Esempio n. 2
0
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     if (txtResetPass.Text == txtResetPassver.Text)
     {
         myDatabase    db         = new myDatabase();
         SqlConnection connection = new SqlConnection(db.con);
         SqlCommand    cmd        = new SqlCommand("update taikhoan set password ='******'where username ='******'", connection);
         txtResetPass.Focus();
         txtResetPassver.Clear();
         connection.Open();
         cmd.ExecuteNonQuery();
         connection.Close();
         MessageBox.Show("Đặt mật khẩu thành công!");
         this.Close();
         Login m = new Login();
         m.Show();
     }
     else
     {
         MessageBox.Show("the new password do not match so enter same password");
     }
 }