示例#1
0
        private void btnQuayLai_Click(object sender, EventArgs e)
        {
            TrangChu tc = new TrangChu();

            this.Hide();
            tc.Show();
        }
示例#2
0
        private void btnDangNhap_Click(object sender, EventArgs e)
        {
            int       i  = 0;
            DataTable dt = new DataTable();

            ketNoiCSDL.Open();
            SqlCommand command = new SqlCommand("sp_DangNhapTaiKhoan", ketNoiCSDL);

            command.CommandType = CommandType.StoredProcedure;
            command.Par0ameters.Add("@tendangnhap", SqlDbType.VarChar).Value = tbTenDangNhap.Text;
            command.Parameters.Add("@matkhau", SqlDbType.VarChar).Value      = tbMatKhau.Text;
            SqlDataReader read = command.ExecuteReader();

            dt.Load(read);
            ketNoiCSDL.Close();
            if (dt.Rows.Count != 0)
            {
                TrangChu tc = new TrangChu();
                this.Hide();
                tc.Show();
            }
            else
            {
                MessageBox.Show("Nhập sai thông tin");
                i++;
                if (i == 3)
                {
                    MessageBox.Show("Nhập sai quá 3 lần");
                    this.Close();
                }
            }
            //int i = 0;
            //if(tbTenDangNhap.Text == "admin" && tbMatKhau.Text == "1")
            //{
            //    TrangChu tc = new TrangChu();
            //    this.Hide();
            //    tc.Show();
            //}
            //else
            //{
            //    MessageBox.Show("Nhập sai thông tin");
            //    i++;
            //    if (i == 3)
            //    {
            //        MessageBox.Show("Nhập sai quá 3 lần");
            //        this.Close();
            //    }
            //}
        }