Made connection to PowerPivot DataModel, how can I fill a dataset with it?
Asked Answered
S

1

0

I was able to connect to the powerpivot datamodel with amo:

string ConnString = 
       "Provider=MSOLAP;Data Source=$Embedded$;
       Locale Identifier=1033;Location=" + ThisAddIn.Current.Application.
       ActiveWorkbook.FullName + ";SQLQueryMode=DataKeys";

Microsoft.AnalysisServices.Server OlapServer = 
                                        new Microsoft.AnalysisServices.Server();

and I am able to retrieve the column names but nothing else. How can I fill a dataset from the model or even how can I view the cell values within this datamodel? I have attempted this

AdomdConnection Conn = new AdomdConnection(ConnString);//using the above string
Conn.Open();
command = new AdomdCommand("SELECT [Table1].[x] ON COLUMNS FROM [Model]",Conn);
adapter = new AdomdDataAdapter(command);
adapter.Fill(dataset);

but all that shows up is the number 1 as the contents no matter what is in the datamodel.

Stepmother answered 15/7, 2014 at 16:31 Comment(1)
Using a DAX query instead of a MDX query did the trick thanks.Stepmother
S
0

Using a DAX query instead of a MDX query solved the problem.

Stepmother answered 9/9, 2014 at 16:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.