Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            BanHang b = new BanHang();

            this.Hide();
            b.ShowDialog();
            this.Show();
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(@"Data Source=LAPTOP-4NRRL3NS\MSSQLSERVER01;Initial Catalog=demo;Integrated Security=True");


            conn.Open();
            string        tk  = textBox1.Text;
            string        mk  = textBox2.Text;
            string        sql = "select *from TAIKHOAN where TENDANGNHAP= '" + tk + "' and MATKHAU= '" + mk + "'";
            SqlCommand    cmd = new SqlCommand(sql, conn);
            SqlDataReader dta = cmd.ExecuteReader();

            if (dta.Read() == true)
            {
                //Chon v = new Chon();
                //this.Hide();
                //v.ShowDialog();
                //this.Show();
                if (textBox1.Text == "ho")
                {
                    BanHang n = new BanHang();
                    this.Hide();
                    n.ShowDialog();
                    this.Show();
                }
                else
                {
                    Main m = new Main();
                    this.Hide();
                    m.ShowDialog();
                    this.Show();
                }
            }
            else
            {
                MessageBox.Show("Đăng nhập thất bại ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }