Hi,

I want to read an excel file and load it in GridView, but I get an error:
System.Data.OleDb.OleDbException: The Microsoft Access database engine cannot open or write to the file
Here is some of the code I have:

protected void btnImport_Click(object sender, EventArgs e) { string connString = ""; string fileName = @"path\filename.xlsx"; string strFileType = Path.GetExtension(fileName).ToLower(); string path = @"path\"; //Connection String to Excel Workbook if (strFileType.Trim() == ".xls") { connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\""; } ...

Go to the complete details ...