-1

I am trying to use linq_to_excel

http://www.softinterface.com/DL/DL_UserData_Proc.ASP

This is my code:

var data = new LinqToExcel.ExcelQueryFactory();
            data.FileName= @"FRM_DTA.xlsx";
            data.AddMapping<ExcelFileDefinition>(x => x.FARM_ID, "FRM_ID");
            data.AddMapping<ExcelFileDefinition>(x => x.FARM_OWNER, "FRM_OWNER");
            data.AddMapping<ExcelFileDefinition>(x => x.FARM_AREA_ID, "FRM_AREA_ID");
            data.AddMapping<ExcelFileDefinition>(x => x.FARM_EMARA_ID, "FRM_EMARA_ID");
            data.AddMapping<ExcelFileDefinition>(x => x.FARM_REGION_ID, "FRM_REGION_ID");
            data.AddMapping<ExcelFileDefinition>(x => x.FARM_NUMBER, "farmNumber");
            data.AddMapping<ExcelFileDefinition>(x => x.RECEIVING_CENTER_ID, "RecievingCentreID");
            var result = from x in data.Worksheet<ExcelFileDefinition>()
                         select x;
            (foreach(var row in result){
                Console.WriteLine(row.FARM_ID);
            }

when I run it, I got this exception:

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

Help please

What I have tried

I found this question Microsoft.ACE.OLEDB.12.0 provider is not registered and I changed my platform target from any cpu to x86 but still have the problem

Community
  • 1
  • 1
Anastasie Laurent
  • 877
  • 2
  • 14
  • 26

2 Answers2

4

I needed to download Office 2007 System Driver: Data Connectivity Components version: https://www.microsoft.com/en-us/download/confirmation.aspx?id=23734

Ad23
  • 106
  • 1
  • 7
3

Download and install Microsoft Access Database Engine 2010 Redistributable

Peter Kiss
  • 9,309
  • 2
  • 23
  • 38