Reputation: 287
I am trying to read data from Excel file into my windows application.
Connection String :
provider = Microsoft.Jet.OLEDB.4.0; Data Source = "Excel File";
Extended Properties = \"Excel 8.0; HDR = Yes; ImportMixedTypes = Text;
Imex = 1;\"
With this connection string I am able to read data from Excel file even though Microsoft office - Excel is not installed onto the computer. But some how, my program is not compatible with this connection string.
Connection String which I am using right now is
provider = Microsoft.ACE.OLEDB.12.0; Data Source = "Excel file";
Extended Properties = "Excel 12.0; HDR = Yes; Imex = 1;
This connection string is compatible with my program but it only works on the computer which do have Microsoft office - Excel install.
Can anyone suggest me where I am making mistake.
Thanks.
Upvotes: 4
Views: 11634
Reputation: 4657
Microsoft removed the JET engine in all versions of Windows after 2003, including 64-bit Windows 2003. ACE is the modern alternative, but it is not distributed with the base install of Windows either.
In order to use ACE, you need to deploy the free ACE redistributable from Microsoft to all target machines that do not have Office installed. Then, you can use the second connection string you listed on any of them.
Get it from Microsoft here: http://www.microsoft.com/en-us/download/details.aspx?id=13255
Upvotes: 5
Reputation: 423
If you can use third party libraries, there is a pretty nice project out there that offers the use of Linq to access excel files. Check it out at : http://code.google.com/p/linqtoexcel/
Upvotes: 0