I replace with the new provider like this below: private const string OledbProviderString = Source=|DataDirectory|OlsonWindows.xlsx Extended Properties='Excel 12.0 HDR=YES ' " īut as I do this, there's one thing you should notice. private const string OledbProviderString = "Provider=.4.0 Data Source=|DataDirectory|\OlsonWindows.xls Extended Properties=""Excel 8.0 HDR=YES""" This one here below works splendidly on my dev machine but on server gives me an error even after installing the latest ODBC drivers, which I think this is the problem, but this is how I solved it.
There's a Windows Server 2008 R2, I install the Access drivers for a 圆4 bit machine and I get rid of this message, which makes me very happy just to bump into another. I know that I have this problem over and over when I deploy my application on a new server because I'm using this driver to connect to a Excel file.
If Application is compiled with An圜PU flag, it will look for 64 bit Access drivers on 64 bit OS and 32 bit access drivers on 32 bit OS. If (Path.GetExtension(path).ToLower().Trim() = ".xls" & Environment.Is64BitOperatingSystem = false)ĬonnString = "Provider=.4.0 Data Source=" + path + " Extended Properties=""Excel 8.0 HDR=Yes IMEX=2""" ĬonnString = "Provider=.12.0 Data Source=" + path + " Extended Properties=""Excel 12.0 HDR=Yes IMEX=2""" AccessDatabaseEngine_圆4.exe /passiveĭownload drivers .12.0 private void ProcessFile( string path) This hack works till Office 2013 only, Microsoft stopped this workaround from Office 2016 for .16.0 drivers. If you have already installed Office 32 bit then you need to run driver from cmd with /passive argument. The application compiled in 32/64 bit mode does not impact the selection of driver.Īlways install the 64 bit driver of .12.0 on OS 64 bit. If file extension is xlsx or OS is 64 bit then you must have to use " .12.0". Microsoft has not released 64 bit version of this driver. If the file extension is xls and OS is 32 bit then only you can use " .4.0". but I am summarizing the things for understanding: I know it's quite old questions and many persons has answered.