25 July 2014

How to: process SSAS database via C# code

There are several ways to process a database, but if you'd like to use C# code, then this is the way:

using Microsoft.AnalysisServices;


void main()
{
            try
            {
             
                Server OlapServer = new Server();
                Database db = null;
                OlapServer.Connect("Provider=MSOLAP;Data Source=ServerName;");
                db = OlapServer.Databases.FindByName("");
             
                db.Process(ProcessType.ProcessFull );
             
                OlapServer.Disconnect();
            }
            catch (Exception eex)
            {
                System.Diagnostics.Trace.TraceInformation(eex.Message);
            }
}


You can make changes to the Process Type by changing the Process Type enumeration.

Good luck!

No comments:

Post a Comment