首先需要先引用 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. 关于github在mac 10.10上无法提交代码的解决办法---备用

    接下来是正文:本文主要说明在mac 10.10版本下github无法提交代码的问题 首先如果你是一个用终端提交代码的,你可以不用看这篇文章了,这篇文章主要是用于解决github客户端提交代码的问题,此 ...

  2. scrollview始终显示滚动条 Android

    设置scrollview的:android:fadeScrollbars="false"表示始终显示垂直滚动条

  3. 周末“干活”之 Mesos Meetup

    周末两天都是大雾霾天,作为运营也不能在家宅,告别了技术就得腿儿勤点儿. 非常感谢 Linker 的 Sam Chen 和 数人科技 的 CTO 共同组织的Mesos Meetup,OneAPM 最帅的 ...

  4. linux下查看文件编码及修改编码

    http://blog.csdn.net/jnbbwyth/article/details/6991425 查看文件编码在Linux中查看文件编码可以通过以下几种方式:1.在Vim中可以直接查看文件编 ...

  5. [jobdu]不用加减乘除做加法

    使用异或和与,模拟机器的加法.http://blog.csdn.net/htyurencaotang/article/details/11125415 #include <iostream> ...

  6. 《ArcGIS Engine+C#实例开发教程》第一讲桌面GIS应用程序框架的建立

    原文:<ArcGIS Engine+C#实例开发教程>第一讲桌面GIS应用程序框架的建立 摘要:本讲主要是使用MapControl.PageLayoutControl.ToolbarCon ...

  7. absolute和relative的几个Demo

    这些例子最好通过FireFox结合FireBug调试查看 1.absolute让元素inline-block化 <!DOCTYPE html> <html xmlns="h ...

  8. proc 文件系统调节参数介绍

    /proc/net/* snmp文件 Ip: ip项 Forwarding        : 是否开启ip_forward,1开启,2关闭 DefaultTTL       : IP默认ttl. In ...

  9. Mysql表的七种引擎类型,InnoDB和MyISAM引擎对比区别总结

    InnoDB和MyISAM区别总结 我用MySQL的时候用的是Navicat for MySQL(Navicat for mysql v9.0.15注册码生成器)操作库.表操作的,默认的表就是Inno ...

  10. POJ 3169 Layout 差分约束系统

    介绍下差分约束系统:就是多个2未知数不等式形如(a-b<=k)的形式 问你有没有解,或者求两个未知数的最大差或者最小差 转化为最短路(或最长路) 1:求最小差的时候,不等式转化为b-a>= ...