I am trying to pull data from a PivotTable in Excel but I would imagine the best way to do this would be to access the data source directly.
In Excel, it appears that the connection string is:
Provider=MSOLAP.4;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=XXXX XXX XXXX Reporting;Data Source=ustcaXXX\nabi;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error
I checked this with the .odc file and it appears to be the same connection information:
<odc:Connection odc:Type="OLEDB">
<odc:ConnectionString>Provider=MSOLAP.4;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=XXXX XXX XXXX Reporting;Data Source=ustcaXXX\nabi;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error</odc:ConnectionString>
<odc:CommandType>Cube</odc:CommandType>
<odc:CommandText>XIMS XXX</odc:CommandText>
<odc:AlwaysUseConnectionFile/>
</odc:Connection>
Anyway, when I use the following code I get an error (after about 5 seconds of delay): "The following system error occurred: No such host is known."
OleDbConnection conn = new OleDbConnection("Provider=MSOLAP.4;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=XXXX XXX XXXX Reporting;Data Source=ustcaXXX\nabi;MDX Compatibility=1;Safety
Options=2;MDX Missing Member Mode=Error");
try
{
conn.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
One thing I noticed is that it is using Windows Authentication when accessed in Excel, which leads me to believe I may have to specify that this is a "Trusted Connection". The error message puzzles me though.