与PowerPivot DataModel建立连接后,如何用它填充数据集? [英] Made connection to PowerPivot DataModel, how can I fill a dataset with it?

查看:263
本文介绍了与PowerPivot DataModel建立连接后,如何用它填充数据集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够使用amo连接到powerpivot数据模型:

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);

但是无论数据模型中的内容如何,​​显示的都是数字1。 / p>

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

推荐答案

使用DAX查询而不是MDX查询可以解决此问题。

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

这篇关于与PowerPivot DataModel建立连接后,如何用它填充数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆