C# .NET - Expert data in excel to gridview - Asked By raj kumar on 02-Jun-13 07:36 AM

The .Net Framework Data Providers require Microsoft Data Access Components(MDAC).  Please install Microsoft Data Access Components(MDAC) version 2.6 or later.

this is my code:

string constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ txtpath.Text +";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"";
        OleDbConnection con = new OleDbConnection(constr);
        OleDbDataAdapter ada = new OleDbDataAdapter(" select * from [Sheet1$]", con);
        DataTable ds = new DataTable();
        ada.Fill(ds);
        gvExcel.DataSource = ds;
        gvExcel.DataBind();
Rick Tipton replied to raj kumar on 13-Jun-13 04:22 AM

All .NET applications that use data-access functionality require MDAC 2.6 or later. You can read more about this on:

http://support.microsoft.com/kb/315467

Also I stumbled upon some known issue with MDAC on .NET 2.0 framework, so if you have MDAC installed and you’re using .NET 2.0 try fixing this issue by starting your command prompt and run the following command: sfc /scannow

Bill B replied to Rick Tipton on 18-Jun-13 02:13 AM
you should be using 2.8 by now anyway