private void btnTimKiem_Click(object sender, EventArgs e) { KetNoi_CSDL.TaoKetNoi(); dgrMH.DataSource = null; string sql5 = "Select * from MonHoc where MAMH like '%" + txtTimMH.Text + "%' or TENMH like '%" + txtTimMH.Text + "%' or SOTIET like '%" + txtTimMH.Text + "%'"; dgrMH.DataSource = KetNoi_CSDL.LoadDuLieu(sql5, "MonHoc"); }
private void btnTimKiem_Click(object sender, EventArgs e) { KetNoi_CSDL.TaoKetNoi(); dgrLop.DataSource = null; string sql4 = "Select * from Lop where MALOP like '%" + txtTimLop.Text + "%' or TENLOP like '%" + txtTimLop.Text + "%'"; dgrLop.DataSource = KetNoi_CSDL.LoadDuLieu(sql4, "Lop"); }
private void btnTim_Click(object sender, EventArgs e) { KetNoi_CSDL.TaoKetNoi(); dgrKhoa.DataSource = null; string sql6 = "Select * from Khoa where MAKHOA like '%" + txtTimKhoa.Text + "%' or TENKHOA like '%" + txtTimKhoa.Text + "%'"; dgrKhoa.DataSource = KetNoi_CSDL.LoadDuLieu(sql6, "Khoa"); }
private void btnTimKiem_Click(object sender, EventArgs e) { KetNoi_CSDL.TaoKetNoi(); dgrKetQua.DataSource = null; string sql1 = "Select * from SinhVien where MASV like '%" + txtTimKiemSV.Text + "%' or TENSV like '%" + txtTimKiemSV.Text + "%' or SDT like '%" + txtTimKiemSV.Text + "%'"; //string sql1 = "Select * from User where USERNAME like '%"+txtTimKiemSV.Text+"%'"; dgrKetQua.DataSource = KetNoi_CSDL.LoadDuLieu(sql1, "SinhVien"); }
private void btnLogin_Click(object sender, EventArgs e) { if (txtUsername.Text == "admin" && txtPassword.Text == "admin") { MessageBox.Show("Đăng nhập với tư cách quản trị viên"); frmMainQLSV f20 = new frmMainQLSV(); f20.Show(); this.Hide(); } else { KetNoi_CSDL.TaoKetNoi(); string strSql = "Select COUNT(*) from NGUOIDUNG where TENDN = @ID and MATKHAU = @PWD"; OleDbCommand cmd = new OleDbCommand(strSql, KetNoi_CSDL.cnnQLSV); cmd.Parameters.AddWithValue("@ID", txtUsername.Text); cmd.Parameters.AddWithValue("@PWD", txtPassword.Text); this.Hide(); if (Convert.ToBoolean(cmd.ExecuteScalar())) { MessageBox.Show("Đăng nhập thành công"); frmSV fm = new frmSV(); fm.Show(); this.Hide(); } else { MessageBox.Show("Sai tên đăng nhập hoặc mật khẩu"); this.Show(); } // KetNoi_CSDL.Huy_KetNoi(); } }
public frmTimKiemThongTinSV() { InitializeComponent(); KetNoi_CSDL.TaoKetNoi(); }