Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
using System;
using System.Data;
using Microsoft.AnalysisServices.AdomdClient;
using System.Data.SqlClient;
namespace TestExample
{
public interface ITabularHelper
{
DataTable GetDataTable(string query);
void ProcessDatabase();
}
public class TabularHelper:ITabularHelper
{
private string asConnectionString;
public TabularHelper(string asConnectionString)
{
this.asConnectionString = asConnectionString;
}
public DataTable GetDataTable(string query)
{
using (AdomdConnection con = new AdomdConnection(asConnectionString))
{
con.Open();
using (AdomdDataAdapter adapter = new AdomdDataAdapter(query, con))
{
DataTable dataTable = new DataTable();
adapter.Fill(dataTable);
return dataTable;
}
}
}
public void ProcessDatabase()
{
using (AdomdConnection con = new AdomdConnection(asConnectionString))
{
con.Open();
string processCommandText = @"
{
""refresh"": {
""type"": ""full"",
""objects"": [
{
""database"": ""validation""
}
]
}
}
";
using (AdomdCommand command = new AdomdCommand(processCommandText, con))
{
command.ExecuteNonQuery();
}
}
}
}
}