Search code examples
visual-studio-2010visual-studioexcelexcel-2007oledb

Is the "Microsoft Office 2007 Primary Interop Assembly" the same thing as the "2007 Office System Driver: Data Connectivity Components"


I'm creating an installer in Visual Studio 2010 for an application that needs to read data from xlsx spreadsheets using an OleDbConnection (the connection string looks like "Provider=Microsoft.Ace.OLEDB.12.0;Data Source='filename';Mode=ReadWrite;Extended Properties='Excel 12.0';HDR='Yes'";

On my machines, I've been installing the "2007 Office System Driver: Data Connectivity Components" from this Microsoft website.

In Visual Studio the list of available prerequisites at Installer->Properties->Prerequisites doesn't include the "2007 Office System Driver: Data Connectivity Components", but it does include the "Microsoft Office 2007 Primary Interop Assemblies" (also available at this Microsoft website).

My question is: will listing the "Microsoft Office 2007 PIA" as a prerequisite allow my OleDbConnection to work for folks who don't already have the "2007 Office System Driver: Data Connectivity Components" installed?


Solution

  • No. You are querying an excel file via ADO.Net and need the data access driver shipped. To do that you can embed Microsoft Access Database Engine Redistributable into your setup program as a prerequisite.

    The 2007 PIA would allow you to create and automate an excel instance via COM interop, which is more powerful (e.g. you get formula cell updates) but a lot slower than the OLEDB interface of Excel.