0
votes

I have an Excel .odc file which defines an OLEDB connection like so:

Provider=MSOLAP.5;
Integrated Security=SSPI;
Persist Security Info=True;
User ID="";
Initial Catalog="";
Data Source=xxx.xxx.com\tabular;
Location=xxx.xxx.com\tabular;
MDX Compatibility=1;
Safety Options=2;
MDX Missing Member Mode=Error


Is it possible for me to open the database using SqlConnection in C# using this?

1
Is this an Excel Add-In, or a stand-alone program? Do you expect to show the results in Excel? - Joel Coehoorn

1 Answers

0
votes

There is nothing built into .Net outside of Office Interop (actually opening an instance of Excel), an Office Add-In (Excel is already opened, and the code runs as a macro), or Reporting Services + Sharepoint to use *.odc files to connect to a database. You will have to write your own code to open the file, parse the values out for a connection string, and use that string to connect to a database.

When you go to write this code, be careful: ODC is not-quite valid XML.