通过 ASHX 服务查询 OLAP 多维数据集

Querying OLAP Cubes via ASHX Service

我正在使用以下代码在 C# 中执行查询:

        // Create Connection String
        AdomdConnection testConnection = new AdomdConnection("Data Source=*****;User ID=******;Provider=MSOLAP.6;Persist Security Info=True;Impersonation Level=Impersonate;Password=******");

        // Test Open
        testConnection.Open();

        // Make Query
        AdomdCommand cmd = new AdomdCommand(@"SELECT { [Measures].[Payment Amount] } ON COLUMNS,
                                             { [Charging Low Orgs].[Charging Division].[Charging Division] } ON ROWS 
                                              FROM [Payments]", testConnection);

        AdomdDataReader dataReader = cmd.ExecuteReader();

        // Close Connection
        testConnection.Close();

而且我在 cmd.ExecuteReader() 调用中不断收到此错误:

{"XML for Analysis parser: The CurrentCatalog XML/A property was not specified."}

我能找到的唯一与此相关的文献是查询未解析,因为未设置模拟,但我在连接字符串中指定了它。

另一篇我认为不相关的文章说要在 Excel 上启用 BAM,但我在 Excel 中没有该选项,我看不出那会怎样为 Web 服务带来改变。

请帮忙!

以下示例在连接字符串中包含目录参数:

static void Main(string[] args)
        {
            AdomdConnection conn = new AdomdConnection(
                "Data Source=localhost;Catalog=Adventure Works DW Standard Edition");
            conn.Open(  );

            string commandText = "SELECT {[Measures].[Sales Amount], " +
                "[Measures].[Gross Profit Margin]} ON COLUMNS, " +
                "{[Product].[Product Model Categories].[Category]} ON ROWS " +
                "FROM [Adventure Works] " +
                "WHERE ([Sales Territory Country].[United States])";

            AdomdCommand cmd = new AdomdCommand(commandText, conn);
            AdomdDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);