First Step into ADOMD.Net - Cannot reference Micro

2019-04-19 02:29发布

问题:

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?

回答1:

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



回答2:

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


回答3:

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



回答4:

AdomdConnection steps

AdomdConnection con = new AdomdConnection("connectionstring");   // connect DB  
con.Open();
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();
    data.Add(dt);
 }


标签: c# adomd.net