Created an SQL Server 2016 Analysis Service Database named "SharePointTimeSlab" with Visual Studio Multidimensional Cube Development Project. Though I did not specifically created a cube in the project.
I created a mining structure with Time Series algorithm with a Key Time Input, a Time Slab input and a Predictable Hit Count Column. The resulting Analysis Server Database looks like this in Sql Server Management Studio:
Now here is the DMX query and the results are shown here.
Problem is, I created a Console C# Project, added the Microsoft.AnalysisServcies.AdoMdClient Reference and gave the following code:
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];
}
}
}
}
}
Problem is, the reader=cmd.ExecuteReader Code is creating an exception. Here is the exception stacktrace:
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 behavior, ICommandContentProvider contentProvider, AdomdPropertyCollection commandProperties, IDataParameterCollection parameters) at Microsoft.AnalysisServices.AdomdClient.AdomdCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.AnalysisServices.AdomdClient.AdomdCommand.ExecuteReader() at HelloDMXQuery.Program.Main(String[] args) in C:\Users\debkanti.afbl\source\repos\Data Mining\HelloDMXQuery\HelloDMXQuery\Program.cs:line 22
What did I do wrong?
User contributions licensed under CC BY-SA 3.0