连接到PowerPivot的用C# [英] Connecting to PowerPivot with C#
问题描述
是否有可能连接到的PowerPivot模型在Excel .xlsx文件? (未托管SharePoint网站...只是本地文件)。
Is it possible to connect to a PowerPivot model in an Excel .xlsx file? (Not hosted on a SharePoint site... just the local file).
它必须,因为画面可以做到这一点。
It must be, since Tableau can do it.
任何人有任何线索
推荐答案
简短的回答:
- 是
龙答:
- 或者Excel或PP(甚至办公室的服务包?)的更新版本可能会破坏你的代码
- 我们成功地连接到使用AMO的PP模型(将表添加到数据源视图,添加尺寸,加措施,并刷新外部DB的模型)。我们发现在CodePlex上表格AMO库(https://tabularamo2012.codeplex.com/)是非常有益的。
- 我们成功地使用ADO(而不是连接到PP模型ADOMD )来查询模型(例如,查询一个度量的值)。
参考/学分:
- < A HREF =http://blog.gobansaor.com/> http://blog.gobansaor.com/
- 的http://sqlblog.com/blogs/default.aspx
- 的 http://powerpivotgeek.com/2009/11/11/a-peek-inside-the-client-architecture/ #comments
- http://blog.gobansaor.com/
- http://sqlblog.com/blogs/default.aspx
- http://powerpivotgeek.com/2009/11/11/a-peek-inside-the-client-architecture/#comments
详细内容:
-
像@gobansaor,我们发现,与已有的PP缓存的连接的工作簿开始是有帮助的(有必要吗?)。通过AMO连接到PP缓存实例之前,我们要确保连接是活着的:
Like @gobansaor, we found that starting with a workbook which already had a connection to the PP cache was helpful (necessary?). Before connecting to the PP cache via AMO for instance, we make sure the connection is alive:
ThisWorkbook.Connections [PowerPivot数据。重新连接()
或
ThisWorkbook.Connections [PowerPivot数据]刷新()
我们使用AMO的连接字符串模板:提供程序= MSOLAP;数据源= $ $嵌入;区域设置标识符= 1033;位置= {0}; SQLQueryMode = DataKeys
,我们充满,在与 ThisWorkbook.FullName
The connection string template we used for AMO was: Provider=MSOLAP;Data Source=$Embedded$;Locale Identifier=1033;Location={0};SQLQueryMode=DataKeys
and we filled that in with ThisWorkbook.FullName
以下@gobansaor,我们通过使用ADO连接到多维数据集:
Following @gobansaor, we connected to the cube via ADO using:
ADODB.Recordset记录集=新ADODB.Recordset();
recordSet.Open (SELECT [措施] [字段1闵] ON COLUMNS FROM [产品型号],
ThisWorkbook.Connections [PowerPivot数据] OLEDBConnection.ADOConnection);
这篇关于连接到PowerPivot的用C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!