ADOMDDataReader创建异常“解析器:由于歧义,无法解析语句方言。”

时间:2018-09-11 11:44:15

标签: time-series ssas sql-server-2016 adomd.net

使用Visual Studio多维多维数据集开发项目创建了一个名为“ SharePointTimeSlab”的SQL Server 2016分析服务数据库。尽管我没有在项目中专门创建多维数据集。

我使用时间序列算法创建了一个挖掘结构,其中包含关键时间输入,时间板输入和可预测的命中计数列。最终的Analysis Server数据库在Sql Server Management Studio中如下所示: Analysis Server Database

现在这是DMX查询,结果显示在这里。 DMX Query and results in SSMS

问题是,我创建了一个控制台C#项目,添加了Microsoft.AnalysisServcies.AdoMdClient参考并提供了以下代码:

static void Main(string[] args)
    {
        const string connectionString = "Data Source=devesql;Catalog=SharePointTimeSlab;Integrated Security=SSPI";

        using (var connection = new AdomdConnection(connectionString))
        {
            connection.Open();

            using (var cmd = new AdomdCommand("SELECT FLATTENED [Time Slab], PredictTimeSeries([Hit Count], 5) ON COLUMNS FROM [SPTS]", connection))
            {
                using (var reader = cmd.ExecuteReader())
                {
                    while(reader.Read())
                    {
                        var timeSlab = (string)reader[0];
                        var monthKey = (string)reader[1];
                        var hitCount = (int)reader[2];
                    }
                }
            }
        }
    }

问题是,reader =cmd。ExecuteReader代码正在创建异常。这是异常堆栈跟踪:

Microsoft.AnalysisServices.AdomdClient.AdomdErrorResponseException
  HResult=0x80131500
  Message=Parser: The statement dialect could not be resolved due to 
  ambiguity.
  Source=Microsoft SQL Server 2016 Analysis Services
  StackTrace:
   at 

Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Microsoft.AnalysisServices.AdomdClient.IExecuteProvider.ExecuteTabular(CommandBehavior行为,ICommandContentProvider contentProvider,AdomdPropertyCollection commandProperties,IDataParameterCollection参数)    在Microsoft.AnalysisServices.AdomdClient.AdomdCommand.ExecuteReader(CommandBehavior行为)    在Microsoft.AnalysisServices.AdomdClient.AdomdCommand.ExecuteReader()    在C:\ Users \ debkanti.afbl \ source \ repos \ Data Mining \ HelloDMXQuery \ HelloDMXQuery \ Program.cs:line 22中的HelloDMXQuery.Program.Main(String [] args)中

我做错了什么?

0 个答案:

没有答案