private void cbLop_SelectedIndexChanged(object sender, EventArgs e) { string txt_Lop = cbLop.Text; if (!SQL_Connect.openConnection()) { MessageBox.Show("Khong ket noi duoc CSDL", "Thong bao loi", MessageBoxButtons.OK, MessageBoxIcon.Error); } DataTable tbHocSinh; tbHocSinh = Doc_Danhsachhocsinh(txt_Lop); Load_DanhSach_HocSinh_ListView(tbHocSinh); }
private void Form1_Load(object sender, EventArgs e) { if (!SQL_Connect.openConnection()) { MessageBox.Show("Khong ket noi duoc CSDL", "Thong bao loi", MessageBoxButtons.OK, MessageBoxIcon.Error); } string sql_docLop = "SELECT TenLop from LOP"; DataTable tb_Lop = SQL_Connect.getTable(sql_docLop); cbLop.Items.Clear(); cbLop.Items.Add(""); for (int i = 0; i < tb_Lop.Rows.Count; i++) { string lop_txt = tb_Lop.Rows[i]["TenLop"].ToString(); cbLop.Items.Add(lop_txt); } DataTable tbHocSinh; tbHocSinh = Doc_Danhsachhocsinh(""); Load_DanhSach_HocSinh_ListView(tbHocSinh); }