Example #1
0
        private void btn_dangnhap_Click(object sender, EventArgs e)
        {
            SqlCommand cm = new SqlCommand();

            cm.Connection  = conn;
            cm.CommandType = CommandType.Text;
            cm.CommandText = @"select * from NguoiDung where username=@ten and pass=@password";
            cm.Parameters.Add("@ten", SqlDbType.NVarChar, 50).Value      = txt_user.Text;
            cm.Parameters.Add("@password", SqlDbType.NVarChar, 50).Value = txt_pass.Text;
            da.SelectCommand = cm;
            da.Fill(dt);

            if (dt.Rows.Count > 0)
            {
                frm_trangchu fr = new frm_trangchu();

                fr.EnableMenu();
                fr.Show();

                Hide();
            }
            else
            {
                MessageBox.Show("Đăng nhập thất bại", "thông báo");
            }
        }
Example #2
0
        private void btn_thoat_Click(object sender, EventArgs e)
        {
            frm_trangchu fr = new frm_trangchu();

            fr.Show();
            Hide();
        }