SSAS系列——【08】多维数据(程序展现Cube)
2014-12-30 09:56
363 查看
原文:SSAS系列——【08】多维数据(程序展现Cube)1、引用DLL?
按照之前安装的MS SQLServer的步骤安装完成后,发现在新建的项目中“Add Reference”时居然找不到Microsoft.AnalysisServices.AdomdClient命名空间,不知道是什么状况?只好添加DLL了,在“C:\Program Files\Microsoft.NET\ADOMD.NET\100\Microsoft.AnalysisServices.AdomdClient.dll”下找到了该文件,该文件的最后修改时间是2009年3月30日,534KB。如图:
代码
按照之前安装的MS SQLServer的步骤安装完成后,发现在新建的项目中“Add Reference”时居然找不到Microsoft.AnalysisServices.AdomdClient命名空间,不知道是什么状况?只好添加DLL了,在“C:\Program Files\Microsoft.NET\ADOMD.NET\100\Microsoft.AnalysisServices.AdomdClient.dll”下找到了该文件,该文件的最后修改时间是2009年3月30日,534KB。如图:
代码
string ReturnCommandUsingCellSet() { //Create a new string builder to store the results System.Text.StringBuilder result = new System.Text.StringBuilder(); //Connect to the local server using (AdomdConnection conn = new AdomdConnection("Provider=SQLNCLI10.1;Data Source=localhost;Integrated Security=SSPI;Initial Catalog=BPDW;")) { conn.Open(); //Create a command, using this connection AdomdCommand cmd = conn.CreateCommand(); cmd.CommandText = @"select {[Measures].[Oil Proved Reserves]} on columns ,{[Dim Time].[年份].&[19]} on rows from [BPDW]where [Dim Geography].[国家名称].&[Total Asia Pacific]&[China]"; //Execute the query, returning a cellset CellSet cs = cmd.ExecuteCellSet(); //Output the column captions from the first axis //Note that this procedure assumes a single member exists per column. result.Append("\t"); TupleCollection tuplesOnColumns = cs.Axes[0].Set.Tuples; foreach (Microsoft.AnalysisServices.AdomdClient.Tuple column in tuplesOnColumns) { result.Append(column.Members[0].Caption + "\t"); } result.AppendLine(); //Output the row captions from the second axis and cell data //Note that this procedure assumes a two-dimensional cellset TupleCollection tuplesOnRows = cs.Axes[1].Set.Tuples; for (int row = 0; row < tuplesOnRows.Count; row++) { result.Append(tuplesOnRows[row].Members[0].Caption + "\t"); for (int col = 0; col < tuplesOnColumns.Count; col++) { result.Append(cs.Cells[col, row].FormattedValue + "\t"); } result.AppendLine(); } conn.Close(); return result.ToString(); } // using connection }
相关文章推荐
- SSAS系列——【08】多维数据(程序展现Cube)
- SSAS系列——【07】多维数据(查询Cube)
- SSAS系列——【07】多维数据(查询Cube)
- SSAS系列——【06】多维数据(创建Cube)
- 微软BI 之SSAS 系列 - 多维数据集中度量值设计时的聚合函数 (累加性_半累加性和非累加性)
- SSAS系列——【05】多维数据(编程体系结构)
- SSAS系列——【04】多维数据(物理体系结构)
- SSAS系列——【03】多维数据(多维数据集对象)
- SSAS系列——【02】多维数据(维度对象)
- 【SQL语法】系列08:利用Update更新表中数据
- OpenGL ES 从零开始系列08:交叉存取顶点数据
- 关于SSAS中从多个cube中查询数据
- PHP应用系列之三:用Memcache守护程序把数据缓存到内存中
- 【EntityFramework系列教程六,翻译】在ASP.NET MVC程序中使用EntityFramework对相关数据进行更新
- 笨鸟先飞学编程系列之一理解程序中的数据
- SQL Server 2012 中 SSAS 多维数据浏览器已经废除
- 【EntityFramework系列教程三,翻译】在ASP.NET MVC程序中使用EntityFramework对数据进行排序、过滤筛选以及实现分页
- 请教一下ssas数据挖掘展现
- 实战ASP.NET MVC 1.0 #1,我的第一支MVC程序,展现所有数据(主细表的Master)
- 【EntityFramework系列教程五,翻译】在ASP.NET MVC程序中借助EntityFramework读取相关数据