lunes, 23 de septiembre de 2013

I hadn't heard of HAB.NET but +1 for finding that. Instead, I just had a dirt simple connectivity test going in .NET like below. I've modified it a bit to work with the DTS stuff. Obviously, you'll need to define your buffer columns and types but hopefully this gets you through the hyperion stuff.
In order to access the Microsoft.AnalysisServices.AdomdClient class, add a reference to ADOMD.NET and save all. Then the below code will function properly.

using System;
using System.Data;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime.Wrapper;

using Microsoft.AnalysisServices.AdomdClient;

public class ScriptMain : UserComponent
{
    public override void CreateNewOutputRows()
    {
        string connectionString = string.Empty;
        connectionString = "Provider=MSOLAP;Data Source=http://hyperion00:13080/aps/XMLA; Initial Catalog=GrossRev;User Id=Revenue;Password=ea$yMon3y;";
        string query = "SELECT ...";
        AdomdDataReader reader = null;
        try
        {
            using (AdomdConnection conn = new AdomdConnection(connectionString))
            {
                conn.Open();
                using (AdomdCommand cmd = new AdomdCommand(query, conn))
                {
                    reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        // Replace Console.WriteLine with assignment of
                        // Output0Buffer.AddRow();
                        // Output0Buffer.column = (stronglyTyped) reader[i]
                        Console.WriteLine(reader.GetString(0));
                        Console.WriteLine(reader.GetString(1));
                    }
                    Console.WriteLine("fin");
                }

            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);

            throw;
        }
    }
}

No hay comentarios:

Publicar un comentario