private void Btquaylai_Click(object sender, EventArgs e) { ManHinhChinh mhc = new ManHinhChinh(); this.Hide(); mhc.ShowDialog(); }
private void Btdangnhap_Click(object sender, EventArgs e) { SqlConnection cn = new SqlConnection(@"Data Source=ADMIN\SQLEXPRESS;Initial Catalog=QLBHmohinh3lop;Integrated Security=True"); string sql = "select * from TAIKHOAN where taikhoan='" + tbtaikhoan.Text + "' and matkhau='" + tbmatkhau.Text + "'"; cn.Open(); SqlCommand cmd = new SqlCommand(sql, cn); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read() == true) { ManHinhChinh mhc = new ManHinhChinh(); this.Hide(); mhc.ShowDialog(); //this.Show(); } else { MessageBox.Show("Sai tên tài khoản hoặc mật khẩu"); } }