Question

I have quite an old code that should run on modern machines. The purpose of that code is to read Excel Files and do some fancy stuff with it.

The Connection-string to the Excel-file is the following:

private static readonly string CONNECTION_STRING_TEMPL =
"Provider=Microsoft.Jet.OleDb.4.0; data source={0}; Extended
Properties=\"Excel 8.0;HDR=YES;IMEX=1;\"";

Now it looks like modern OSses (especially 64bit) do not like Jet.OleDB that much.

Is there a more "modern" driver I can use as a replacement just by changing the connection string? (I do not want to completely rewrite the Code using state-of-ther-art techniques.

Was it helpful?

Solution

You can try ACE.OLEDB

private static readonly string CONNECTION_STRING_TEMPL = "Provider=Microsoft.ACE.OLEDB.12.0;" +
                       "Data Source=" + FilePath + ";" +
                       "Extended Properties='Excel 12.0;HDR=Yes;IMEX=1' ";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top