我没有听说过 HAB.NET,但是 +1 发现了它。相反,我只是在 .NET 中进行了一个简单的连接测试,如下所示。我已经对其进行了一些修改以使用 DTS 的东西。显然,您需要定义缓冲区列和类型,但希望这能让您了解 hyperion 的内容。
为了访问 Microsoft.AnalysisServices.AdomdClient 类,添加对 ADOMD.NET 的引用并保存所有内容。然后下面的代码将正常运行。
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;
}
}
}