コード例 #1
0
        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Hide();
            GiaoDien menu = new GiaoDien();

            menu.ShowDialog();
        }
コード例 #2
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            string tk = tbxTenTaiKhoan.Text;
            string mk = tbxMatKhau.Text;

            SqlDataReader dta = acc.ExecuteReader("Select *from DangNhap where TenDangNhap='" + tk + "'and MatKhau='" + mk + "'");

            if (tbxMatKhau.Text.Length > 8)
            {
                if (dta.Read() == true)
                {
                    this.Hide();
                    GiaoDien menu = new GiaoDien();
                    menu.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Đăng nhập thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Sai mật khẩu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #3
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            //SqlConnection conn = new SqlConnection(@" Data Source=DESKTOP-H1LP27V;Initial Catalog=QuanLyKhoHang;Integrated Security=True");

            // conn.Open();
            //  acc.getconnection();
            string tk = tbxTenTaiKhoan.Text;
            string mk = tbxMatKhau.Text;
            //string sql = "Select *from DangNhap where TenDangNhap='" + tk + "'and MatKhau='" + mk + "'";
            //SqlConnection conn = new SqlConnection();
            //SqlCommand cmd = new SqlCommand(sql, conn);
            SqlDataReader dta = acc.ExecuteReader("Select *from DangNhap where TenDangNhap='" + tk + "'and MatKhau='" + mk + "'");

            if (tbxMatKhau.Text.Length > 8)
            {
                if (dta.Read() == true)
                {
                    this.Hide();
                    GiaoDien menu = new GiaoDien();
                    menu.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Đăng nhập thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Sai mật khẩu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }