Could you please help me take a look at the exception when I use ADOMD to read data

Unanswered Could you please help me take a look at the exception when I use ADOMD to read data

  • Friday, February 01, 2013 8:38 AM
     
     

    Hi all,

    I'm using SQL Server 2012 to run the following code, and got the exception shown as below. do you know what's happened on it? Thanks a lot.

    Thanks

    Winnie

    Exception:

    Error (Data mining): The requested result format is not valid for a DMX query

    Query:

    SELECT [CATALOG_NAME] AS [DATABASE],CUBE_CAPTION AS [CUBE/PERSPECTIVE],BASE_CUBE_NAME
    FROM $system.MDSchema_Cubes
    WHERE CUBE_SOURCE=1

    Code:

     using (AdomdConnection cubeConnection = new AdomdConnection(conString))
                {
                    cubeConnection.Open();
                    try
                    {
                        using (AdomdCommand cmd = new AdomdCommand(query, cubeConnection))
                        {
                            try
                            {
                                CellSet cst = cmd.ExecuteCellSet();                        
                            }
                            catch(Exception ex)
                            {
                                throw ex;
                            }
                           
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }

All Replies

  • Friday, February 01, 2013 1:06 PM
    Answerer
     
     

    if you already code C#.net, why dont you use AMO to get a list of your cubes?


    - www.pmOne.com -

  • Monday, February 11, 2013 4:27 AM
    Moderator
     
     

    What about using the Cubes property of your AdomdConnection?

                foreach (CubeDef c in cubeConnection.Cubes)
                {

                }


    http://artisconsulting.com/Blogs/GregGalloway

  • Monday, February 11, 2013 10:34 AM
     
     

    Hello Winnie,

    a dmx query returns a rowset. you are trying to get a cellset.

    replace your cellset with an adomddatareader.

    Be aware that your user needs admin rights to issue $system queries.

    The easiest way is to work with the cubedef object like furmangg stated.

    If you want to dig deeper inside the ssas database and want a complete

    picture i would advise to work with schemasets.

    http://msdn.microsoft.com/de-de/library/ms126271.aspx

    HTH

    Joschko


    • Edited by Joschko Monday, February 11, 2013 12:22 PM
    •