首先需要先引用 C:\Program Files\Microsoft.NET\ADOMD.NET\100\Microsoft.AnalysisServices.AdomdClient.dll
                        C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.AnalysisServices.DLL           
参照来源为MSDN:http://gallery.technet.microsoft.com/scriptcenter/6901ede5-5d59-4b1f-8f1b-df3c8e645048#content

-------------------------------------------------------------------------------------------------------------------------------------

            using Microsoft.AnalysisServices;
            using Microsoft.AnalysisServices.Hosting;

String ConnStr;

 
            String OLAPServerName;
            String OLAPDB;
            String OLAPCube;
 
 
            OLAPServerName = "HZSV008";
            OLAPDB = "TajimaSalesSubject";
            OLAPCube = "销售主题分析模型";
 
 
            ConnStr = "Provider=MSOLAP;Data Source=" + OLAPServerName + ";";
            //Initial Catalog=Adventure Works DW 2008R2;"; 
 
            Server OLAPServer = new Server();
            OLAPServer.Connect(ConnStr);
 
            Console.WriteLine("ServerName : " + OLAPServerName);
 
            // Database 
            foreach (Database OLAPDatabase in OLAPServer.Databases)
            {
 
                if (OLAPDB == "" || OLAPDatabase.Name.ToString() == OLAPDB)
                {
                    Console.WriteLine("DatabaseName : " + OLAPDatabase.Name);
 
                    // Cube 
                    foreach (Cube OLAPCubex in OLAPDatabase.Cubes)
                    {
                        if (OLAPCube == "" || OLAPCubex.Name == OLAPCube)
                        {
                            Console.WriteLine("CubeName : " + OLAPCubex.Name);
 
                            //Cube Dimension 
                            foreach (CubeDimension OLAPDimension in OLAPCubex.Dimensions)
                            {
                                Console.WriteLine("DimensionName : " + OLAPDimension.Name);
                                Console.WriteLine("    Attributes : ");
 
                                //Dimension Attribute 
                                foreach (CubeAttribute OLAPDimAttribute in OLAPDimension.Attributes)
                                {
                                    Console.WriteLine("          " + OLAPDimAttribute.Attribute.Name);
                                }
 
                                Console.WriteLine("    Hierarchy : ");
 
                                //Dimension Hierarchy 
                                foreach (CubeHierarchy OLAPDimHierarchy in OLAPDimension.Hierarchies)
                                {
                                    Console.WriteLine("          " + OLAPDimHierarchy.Hierarchy.Name);
 
                                    //Dimension Hierarchy Level 
                                    foreach (Level OLAPDimHierachyLevel in OLAPDimHierarchy.Hierarchy.Levels)
                                    {
                                        Console.WriteLine("                " + OLAPDimHierachyLevel.Name);
                                    }
                                }
 
 
                                //Measure Group 
                                foreach (MeasureGroup OLAPMeasureGroup in OLAPCubex.MeasureGroups)
                                {
                                    Console.WriteLine("Measure Group:" + OLAPMeasureGroup.Name);
                                    Console.WriteLine("Measures:");
 
                                    // Measures 
                                    foreach (Measure OLAPMeasure in OLAPMeasureGroup.Measures)
                                    {
                                        Console.WriteLine("          " + OLAPMeasure.Name);
                                    }
 
                                    Console.WriteLine("Measure Group Dimension:");
 
                                    // Measure Group Dimension 
                                    foreach (MeasureGroupDimension OLAPMeasureGroupDimension in OLAPMeasureGroup.Dimensions)
                                    {
                                        Console.WriteLine("          " + OLAPMeasureGroupDimension.CubeDimension.Name);
                                    }
 
                                    Console.WriteLine("Partition:");
                                    //Partitions 
                                    foreach (Partition OLAPPartition in OLAPMeasureGroup.Partitions)
                                    {
                                        Console.WriteLine("          " + OLAPPartition.Name);
                                    }
 
                                }
 
 
                            }
                        }
 
                    }
                }
 
 
 
            }
 
 
            Console.ReadKey(); 

C# Adomd Connection Analysis Service View Cube的更多相关文章

  1. 【转载】Analysis Service Tabular Model #002 Analysis services 的结构:一种产品 两个模型

    Analysis Service 2012 Architecture – One Product, Two Models 在之前SQL Server 2008 R2 版本中的分析服务实际上只有一个版本 ...

  2. 【转载】Analysis Service Tabular Model #003 Multidimensional Model VS Tabular Model 我们该如何选择?

    由于Multidimensional Model 和 Tabular Model 并不能互相转换, 所以在项目之初就应该要考虑好选择哪一种模型进行开发. 以下只是一些建议: Licensing 许可和 ...

  3. Docker: Failed to get D-Bus connection: No connection to service

    Issue: When you execute systemctl command in docker container, you may receive following error. Erro ...

  4. http 连接 analysis service (ssas)

    当数据仓库搭建好后,我们就可以通过sqlserver的管理工具查看服务器上的数据集了.但是这样挺不方便的,如果要远程访问,那么就可以通过http来连接数据仓库.要配置数据仓库http连接非常的简单.如 ...

  5. 修改 Analysis Service 服务器模式

    原网址:http://cathydumas.com/2012/04/23/changing-an-analysis-services-instance-to-tabular-mode/ Say you ...

  6. Sql Server Analysis Service 处理时找到重复的属性键、找不到属性键错误(转载)

    这是两个非常常见的SSAS处理异常,网上也能找到很多文章讲解决办法,但很少见关于异常原因的分析,先来看看第一个" OLAP 存储引擎中存在错误: 处理时找到重复的属性键",一个维度 ...

  7. Sql Server Analysis Service 转换为UnknownMember的正确设置 (转载)

    转载: http://www.cnblogs.com/OpenCoder/p/4754447.html#commentform 在SSAS中事实表数据被归类到为UnknownMember 的时候分为两 ...

  8. SqlServer Analysis Service的事实维度关系

    什么是Fact(事实)维度关系 开发过SSAS Cube的开发人员应该都知道,Cube的维度用法中有一种叫Fact(事实)关系类型,如下图所示: Fact(事实)维度关系就如同上面截图中红框中的描述一 ...

  9. 微软Sql server analysis service数据挖掘技术

    最新在一个项目中要求用到微软SSAS中的数据挖掘功能,虽然以前做项目的时候也经常用到SSAS中的多维数据集 (就是CUBE),但是始终没有对SSAS中的数据挖掘功能进行过了解.所以借着项目需求这股东风 ...

随机推荐

  1. 探索Microsoft.NET目录

    所在目录:D:\Windows\Microsoft.NET(d盘为系统盘) 文件目录 |--D:\Windows\Microsoft.NET |------assembly |------GAC_32 ...

  2. Hadoop Datanode节点无法启动(All directories in dfs.data.dir are invalid)

    Hadoop Datanode节点无法启动(All directories in dfs.data.dir are invalid) java.io.IOException: All director ...

  3. C#.NET连接mysql方法

    C#访问MySQL数据库的方法 (1)首先需要下载C#访问MySQL数据库的ADO.NET驱动程序 下载地址为: http://dev.mysql.com/downloads/connector/ne ...

  4. Python 全栈开发 -- 开发环境篇

    开发环境是一个文本编辑器和 Python 解释器的组合.文本编辑器用来写代码,解释器提供了一种方法来运行编写的代码.一个文本编辑器可以像 Windows 上的 Notepad 一样简单,或是一个复杂的 ...

  5. Java 8 vs. Scala(二):Stream vs. Collection

    [编者按]在之前文章中,我们介绍了 Java 8和Scala的Lambda表达式对比.在本文,将进行 Hussachai Puripunpinyo Java 和 Scala 对比三部曲的第二部分,主要 ...

  6. Fast CGI 工作原理

    http://www.cppblog.com/woaidongmao/archive/2011/06/21/149092.html 一.FastCGI是什么? FastCGI是语言无关的.可伸缩架构的 ...

  7. POJ2220+DFS

    题意:给出n个宝物,m个寻宝人. 每个寻宝人对n个宝物都有一个估价. 从这些估价中挑出某些,是的价值差最小. dfs..没什么好说的,暴力枚举! /* 搜索+枚举 */ #include<std ...

  8. easyui源码翻译1.32--ComboBox(下拉列表框)

    前言 扩展自$.fn.combo.defaults.使用$.fn.combobox.defaults重写默认值对象.下载该插件翻译源码 下拉列表框显示一个可编辑文本框和下拉式列表,用户可以选择一个值或 ...

  9. Altium Designer中默认取消重复画线的选项

  10. !! python 之半年总结

    http://blog.chinaunix.net/uid-26443921-id-3481357.html 半年前开始系统完整深入的了解学习 python 读书篇: <python 核心编程2 ...