Hey guys, so im building this application using ASP.net (visual studio 2005) and i have few dropdown lists.

the dropdown list has an arrow beside it. when u hover over it, it says "choose data source". i click on it but there seems like no option to connect to analysis server. there are other options available such as database, object etc etc.

How do i connect to the analysis server so that i could use values from my cube to make the drop down list?

basically i am going to use those drop downs as my dimensions.

thanks in advanced :)

i think you did not installed MSSQL

i did install MSSQL and I have the option to connect to analysis service from MSSQL. That's not the problem. Problem is I want to connect to analysis service from within the ASP.net but i couldnt find any option

Use AdomdConnection adomdConn = new AdomdConnection();.. a standard connection will not work.

you need the following namespaces:

using Microsoft.AnalysisServices;
using Microsoft.AnalysisServices.AdomdClient;

umm quick question. where do i type in that code? i know that using microsoft.analysisservices would be at the top of the page.

how about AdomdConnection adomdConn line? would that be in the page_load function?

you can place it wherever really.. page load is fine.. it replaces the SQLConnection object you would normally use to connect to a standard OLTP database

THANKS! i will let you know if i get it working :P

so i am trying to connect to the analysis service using the following code but it seems like it wont run. any idea what i might be doing wrong? i am using visual studio 2005

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.AnalysisServices;
using Microsoft.AnalysisServices.AdomdClient;

namespace WebApplication2
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //AdomdConnection adomdConn = new AdomdConnection();
            String connString = "Data Source=localhost;Provider=MSOLAP;";
            String defaultDB = "Analysis Services Tutorial";

            // Create a connection to the Adventure Works OLAP Database
            Set cnn = Server.CreateObject("ADODB.Connection");
            cnn.Open;
            connString;
            if ((Err.Number != 0)) {
                Response.Write;
                Err.Description;
            }
            else {
                cnn.DefaultDatabase = defaultDB;
                // Access the Adventure Works cube catalog
                cat = Server.CreateObject("ADOMD.Catalog");
                cat.ActiveConnection = cnn;
                Set oDim = oCat.CubeDefs("Adventure Works").Dimensions("Product");
                Set oMembers = oDim.Hierarchies(0).Levels(2).Members;
            }

           

        }
    }
}

Line 35 and 36, variable cat should be oCat because line 37 is oCat.

Line 35 and 36, variable cat should be oCat because line 37 is oCat.

yup fixed that but still getting the following errors:

Error 1 Cannot implicitly convert type 'object' to 'Microsoft.AnalysisServices.AdomdClient.Set'. An explicit conversion exists (are you missing a cast?) C:\Documents and Settings\s1102212\My Documents\Visual Studio 2005\Projects\WebApplication2\WebApplication2\WebForm1.aspx.cs 29 23 WebApplication2
Error 2 'Microsoft.AnalysisServices.AdomdClient.Set' does not contain a definition for 'Open' C:\Documents and Settings\s1102212\My Documents\Visual Studio 2005\Projects\WebApplication2\WebApplication2\WebForm1.aspx.cs 30 17 WebApplication2
Error 3 The name 'Err' does not exist in the current context C:\Documents and Settings\s1102212\My Documents\Visual Studio 2005\Projects\WebApplication2\WebApplication2\WebForm1.aspx.cs 32 18 WebApplication2
Error 4 Only assignment, call, increment, decrement, and new object expressions can be used as a statement C:\Documents and Settings\s1102212\My Documents\Visual Studio 2005\Projects\WebApplication2\WebApplication2\WebForm1.aspx.cs 33 17 WebApplication2
Error 5 Only assignment, call, increment, decrement, and new object expressions can be used as a statement C:\Documents and Settings\s1102212\My Documents\Visual Studio 2005\Projects\WebApplication2\WebApplication2\WebForm1.aspx.cs 34 17 WebApplication2
Error 6 The name 'Err' does not exist in the current context C:\Documents and Settings\s1102212\My Documents\Visual Studio 2005\Projects\WebApplication2\WebApplication2\WebForm1.aspx.cs 34 17 WebApplication2
Error 7 'Microsoft.AnalysisServices.AdomdClient.Set' does not contain a definition for 'DefaultDatabase' C:\Documents and Settings\s1102212\My Documents\Visual Studio 2005\Projects\WebApplication2\WebApplication2\WebForm1.aspx.cs 37 21 WebApplication2
Error 8 Cannot implicitly convert type 'object' to 'Microsoft.AnalysisServices.AdomdClient.Set'. An explicit conversion exists (are you missing a cast?) C:\Documents and Settings\s1102212\My Documents\Visual Studio 2005\Projects\WebApplication2\WebApplication2\WebForm1.aspx.cs 39 28 WebApplication2
Error 9 'Microsoft.AnalysisServices.AdomdClient.Set' does not contain a definition for 'ActiveConnection' C:\Documents and Settings\s1102212\My Documents\Visual Studio 2005\Projects\WebApplication2\WebApplication2\WebForm1.aspx.cs 40 22 WebApplication2
Error 10 'Microsoft.AnalysisServices.AdomdClient.Set' does not contain a definition for 'CubeDefs' C:\Documents and Settings\s1102212\My Documents\Visual Studio 2005\Projects\WebApplication2\WebApplication2\WebForm1.aspx.cs 41 33 WebApplication2
Error 11 'Microsoft.AnalysisServices.AdomdClient.Set.Hierarchies' is a 'property' but is used like a 'method' C:\Documents and Settings\s1102212\My Documents\Visual Studio 2005\Projects\WebApplication2\WebApplication2\WebForm1.aspx.cs 42 37 WebApplication2

:confused: I have no clue...hopefully a .NET guru can help out here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.