C# Adomd Connection Analysis Service View Cube

首先需要先引用 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 = "HZSV---008";
            OLAPDB = "Ta-Sales-Subject";
            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(); 

转载于:https://www.cnblogs.com/weschen/p/6264785.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
保证这是完整的中文版,高清,带目录,文件超过240M,只好分成2个上传 SQL Server 2012附带了强大的Analysis Services新功能,可使商业智能得到显著增强。《SQL Server数据库经典译丛:SQL Server 2012 Analysis Services高级教程(第2版)》由Microsoft产品团队的主要成员编写,介绍了如何衣物这些新功能来创建复杂的BI解决方案。为了实现这一目的,你将在《SQL Server数据库经典译丛:SQL Server 2012 Analysis Services高级教程(第2版)》中了解到如何使用SQL Server Analysis Services设计、构建和处理多维和表格商业智能语文模型(BISM)。随后,你将使用MDX DAX来查询这些数据库,以便 可以针对业务问题提供高级分析,并构建端到端的解决方案以满足你的需求。   主要内容:   介绍如何利用SQL Server Data Tools米构建Analysis;   Services多维数据库和表格数据厍;   分享DAX和MDX的基本概念并深入介绍父子层次结构;   以及基于时间的分析等高级概念;   演示用于分析和优化DAX和MDX查询性能的方法;   介绍如何将Excel 2010与Analysis Services结合使用来分;   析数据并商效利用PowerPivot for SharePoint;   解释Power View设置和配置并通过实际的方案来帮助简化报告过程作者简介。 作者简介   哈日那思(Sivakumar Harinath),SQL Server Analysis Serwces团队的资深项目经理。      菲尔格林(Ronald Pihlgren),SQL Server Analysis Services团队的资深测试工程师      John Sirmon,Microsoft SQL Server客户咨询团队的资深项目经理。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值