首先需要先引用 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. c# 获取MP3和AMR文件格式的时长

    //网上摘录整理private long GetAMRFileDuration(string fileName) { ; FileStream fs = new FileStream(fileName ...

  3. 肾果手机App Store切换区域(无需Visa或者万事达)

    8月份在肾果官网买了个touch6,有时候需要换区去墙外下载app,然而一个个国家都要输入Visa或者万事达卡...今天终于找到一个不用输入信用卡号的区域:Canada!!! 办法(适用于8.X,7. ...

  4. Android之监测手机网络状态的广播

    Android之监测手机网络状态的广播 Android 监控网络状态 Android利用广播监听设备网络连接(断网)的变化情况

  5. 安卓接入ShareSDK问题

    平台图标错乱原因  导出的jar包 包括了 style.class R$attr.class MainActivity.class R$color.class R$drawable.class R$s ...

  6. 四大主流云平台对比--CloudStack, Eucalyptus, vCloud Director和OpenStack。

    我迟早可能都要进入的领域,提前温习... 还有KVM,ESXI,API,XEN之间的术语和关系,也要心中有数.. ~~~~~~~~~~~~~~~~~~~ 云计算在如今的IT界一直是一个最热门的话题,鉴 ...

  7. Codeforces Round #232 (Div. 1)

    这次运气比较好,做出两题.本来是冲着第3题可以cdq分治做的,却没想出来,明天再想好了. A. On Number of Decompositions into Multipliers 题意:n个数a ...

  8. SPRING IN ACTION 第4版笔记-第五章BUILDING SPRING WEB APPLICATIONS-002-Controller的requestMapping、model

    一.RequestMapping 1.可以写在方法上或类上,且值可以是数组 package spittr.web; import static org.springframework.web.bind ...

  9. 145. Binary Tree Postorder Traversal

    题目: Given a binary tree, return the postorder traversal of its nodes' values. For example:Given bina ...

  10. .NET的类型层次查看工具

    上周为了快速了解一个.NET的库而需要查看其类型层次.假如要在文章中表示一个类型层次,还是用文本比较舒服,截图始终是不方便.Reflector虽然能够显示类型层次,但我无法方便的把显示出来的类型层次转 ...