tags:

views:

82

answers:

1

how do we process a cube or access OLAP database through ASP.Net with C# code? what is the component to be used, in C#.Net for connecting OLAP database or process actions in anaysis Services ?

+2  A: 

For processing, use Microsoft.AnalysisServices library, example code looks like:

    Server server = new Server();
    server.Connect(cubeConnectionString);

    Database database = server.Databases.FindByName(databaseName);
    Cube cube = database.Cubes.FindByName(cubeName);

    cube.Process(ProcessType.ProcessFull);

For querying, use Microsoft.AnalysisServices.AdomdClient library, example code looks like:

    using (Adomd.AdomdConnection adomdConnection = new Microsoft.AnalysisServices.AdomdClient.AdomdConnection())
    {
        adomdConnection.ConnectionString = cubeConnectionString;
        Adomd.AdomdCommand adomdCommand = new Microsoft.AnalysisServices.AdomdClient.AdomdCommand();
        adomdCommand.Connection = adomdConnection;
        adomdCommand.CommandText = mdxQuery;
        adomdConnection.Open();
        cellSet = adomdCommand.ExecuteCellSet();
        adomdConnection.Close();
    }

Note that the two namespaces overlap, so you may need to alias if you use them in the same place.

http://msdn.microsoft.com/en-US/library/ms124924(v=SQL.90).aspx

http://msdn.microsoft.com/en-us/library/ms123483(v=SQL.90).aspx

Meff
thanks for the reply
Sreejesh Kumar