Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programatically connect and refresh tabular data model on SQL Sever Analysis Service

I'm very new to SSAS. I have a system where I use C# to populate a SQL server table from a C# DataTable.

I have a SSAS setup that uses this SQL server table as a data source. How, do I connect to this SSAS and refresh the model from C#? I essentially want to do this connect/refresh thing from my code after I'm done appending the C# DataTable to the SQL Server table.

On a separate note, is it possible to eliminate the middle man here - SQL server table and directly populate the C# DataTable to a SSAS tabular data model?

like image 715
Bugaboo Avatar asked Feb 06 '26 19:02

Bugaboo


1 Answers

Add a reference to Microsoft.AnalysisServices (you can find it in SQL Server install directory) and then enter the following code.

using Microsoft.AnalysisServices;

...

Server server = new Server();

server.Connect("Data source=YourServerName;Timeout=6000;Integrated Security=SSPI");

Database database = server.Databases.FindByName("YourCubeName");
database.Process(ProcessType.ProcessFull);

you may have to adjust the Timeout depending on your cube processing time

like image 168
Daryl Wenman-Bateson Avatar answered Feb 08 '26 09:02

Daryl Wenman-Bateson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!