private void nhapsvexcel_Click(object sender, EventArgs e) { if (kq.kiemtraquyenuser(FormDangnhap.loginUsename, "sinhvien", "add") == true) { openFileDialog1.ShowDialog(); string pathToExcelFile = "" + @openFileDialog1.FileName; string loi = ""; SinhVienRepositories sv = new SinhVienRepositories(); // try // { sv.nhapsv_excel(ref loi, pathToExcelFile); if (loi == "") MessageBox.Show("Đã đọc file Excel thành công"); else MessageBox.Show("Các dòng bị lỗi trong file Excel bạn muốn import vào " + loi); // } // catch { MessageBox.Show("Đã có lỗi trong quá trình đọc file Excel"); } } else { MessageBox.Show("Bạn không có quyền thực hiện lệnh này"); } }