0
votes

I leave it to you because I am totally desperate.

I am using Microsoft.Jet.Oledb.4.0 to read my excel files, it works fine on my pc but when I put the application on my server (Windows Server 2012 R2) I get The 'Microsoft.Jet error. OLEDB.4.0 'provider is not registered on the local machine. By doing research on the Internet I could see that the application had to be build correctly compared to the server but nothing helped I tried in x64 and x86 and I still have the error (i have also tested Jet.Oledb.12.0 but still nothing). there is my code :

            if (Path.GetExtension(path).ToUpper() == ".XLS")
            { //&& Environment.Is64BitOperatingSystem == false) {
                //Connectionstring for excel v8.0    
                Console.WriteLine("Jet.OLEDB.4.0");
                connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=Excel 8.0";
            }
            else
            {
                //Connectionstring fo excel v12.0
                Console.WriteLine("Jet.OLEDB.12.0");
                connString = "Provider=Microsoft.Jet.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0";
            }

There is my server settings : ComputerSettings

There is the installation on the server :

enter image description here

Do you have an idea ? Thank's in adavance ;)

1

1 Answers

2
votes

First, change your connection string from Microsoft.Jet.Oledb.4.0 to Microsoft.ACE.OLEDB.12.0 using this link.

Secondly, install Microsoft Access Database Engine 2010 Redistributable.

It‘s an update for the old Microsoft.Jet.Oledb.4.0 driver and used to make the Microsoft.ACE.OLEDB.12.0 connection string works properly.