Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 连接到PowerPivot数据模型,如何用它填充数据集?_C#_Excel_Olap Cube_Powerpivot_Datamodel - Fatal编程技术网

C# 连接到PowerPivot数据模型,如何用它填充数据集?

C# 连接到PowerPivot数据模型,如何用它填充数据集?,c#,excel,olap-cube,powerpivot,datamodel,C#,Excel,Olap Cube,Powerpivot,Datamodel,我能够使用amo连接到powerpivot数据模型: string ConnString = "Provider=MSOLAP;Data Source=$Embedded$; Locale Identifier=1033;Location=" + ThisAddIn.Current.Application. ActiveWorkbook.FullName + ";SQLQueryMode=DataKeys"; Microsoft.AnalysisSe

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

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();
我可以检索列名,但不能检索其他内容。如何从模型中填充数据集,甚至如何查看此数据模型中的单元格值?我已经尝试过了

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作为内容。

使用DAX查询而不是MDX查询解决了问题。

使用DAX查询而不是MDX查询解决了问题。

谢谢。