void Load_Teacher(string magv) { DataTable dt = new DataTable(); try { dt = teacherBUS.SearchTeacherIf(magv); txtNameTeacher.DataBindings.Clear(); txtNameTeacher.DataBindings.Add("Text", dt, "TenGV", true, DataSourceUpdateMode.Never); } catch (Exception) { } }
private void btnSearch_Click(object sender, EventArgs e) { try { if (txtSearch.Text != "") { //values[0] : mã giáo viên values[0] = (txtSearch.Text); if (teacherBUS.ExistsOfTeacher(values[0]) == 0) { throw new Exception(); } dtgvTeacher.DataSource = teacherBUS.SearchTeacherIf(values[0]); } else { Load_Teacher(); } } catch (Exception) { } }