First Step into ADOMD.Net - Cannot reference Microsoft.AnalysisServices

Can someone help me out please, as google is not providing the answers.

I've got a SharePoint 2007 setup which uses SQL Server 2008 R2 SSAS OLAP cubes via some web parts.

As a C# developer, Sharepoint is a nightmare, so I decided I needed to try to get to grips with just C# and OLAP interaction. My cubes all exist, and are working, so all I needed to do was create a simple C# App to get it all straight in my mind.

I've downloaded Microsoft.AnalysisServices v10.0.0.0 and I can see it sitting happily in my GAC, but I can't add a reference from within my Visual Studio 2010 C# 4.0 project. It's just notappearing. I've tried setting the app to use 3.5, but still no joy.

Any clues?


Have you added the reference for Microsoft.AnalysisServices.AdomdClient.dll located in C:\Program Files\Microsoft.NET\ADOMD.NET\100

You could also use the nuget package manager. Type this in the console

Deprecated version (does not exist anymore):

    install-package Microsoft.AnalysisServices.AdomdClient

New version:

    Install-Package Microsoft.AnalysisServices.AdomdClient.retail.amd64

I think you need to reference the file directly, rather than through the GAC. It should be located in C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies

AdomdConnection steps

AdomdConnection con = new AdomdConnection("connectionstring");   // connect DB  
AdomdCommand cmd = new AdomdCommand("MDX query", con); //query

AdomdDataReader reader = cmd.ExecuteReader(); //Execute query

while (reader.Read())   // read
    Data dt = new Data();  // custom class
    dt.Gender = reader[0].ToString();

    dt.Eid = reader[1].ToString();
    dt.salary = reader[2].ToString();

Need Your Help

Best way to change dictionary key

c# dictionary

I am wondering is there a better way to change a dictionary key, for example: