Ejemplo n.º 1
0
        private void btnExit_Click(object sender, EventArgs e)
        {
            Menucs menu = new Menucs();

            menu.Show();
            menu.FormClosed += new FormClosedEventHandler(menu_FormClosed);
            this.Hide();
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection con   = new SqlConnection(@"Data Source=DESKTOP-4NNB39U\SQLEXPRESS;Initial Catalog=BanHang;Integrated Security=True");
            String        query = "Select * from tbl_Login where username ='******'and userpassword ='******'";


            SqlDataAdapter sda = new SqlDataAdapter(query, con); //show du lieu ra
            DataTable      dt  = new DataTable();                //mot vung show du lieu

            sda.Fill(dt);                                        //data adapter vao datatable


            if (dt.Rows.Count == 1)
            {
                Menucs main = new Menucs();
                main.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Kiem tra lai tai khoan hoac mat khau");
            }
        }