|
Okay, I got this to work by taking (borrowing?) just the code I needed and I compiled it in Visual Studio 10.0 targetting .NET 3.5 Framework (couldn't get it to work targetting .NET 2.0). My version of SSAS is 10.50.1600.1 (as expected).
My version of msmgdsrv.dll is 9.0.0.0 when I compile it but this works fine when I add the assembly into SSAS 2008 R2 for some reason. I can use the functions in SSMS when writing MDX queries and (more importantly) when defining custom drill-through
actions in BIDS.
I am confused as well - because I see no reason why your DLL shouldn't work exactly the same way - but it definitely gives me an error (the error I listed above). The same happens if I recompile the source code on my machine and then try to link it.
I guess I could try mucking around with it - but to be honest, now I have this working, I am loathe to play with it too much ;p
I don't know if it will help - but here is the code I am compiling:
using System;
using System.Data;
using System.Data.OleDb;
using Microsoft.AnalysisServices.AdomdServer;
namespace ASSP
{
public partial class SQLQuery
{
public static DataTable ExecuteSQL(string connectionString, string sql)
{
OleDbConnection conn = new OleDbConnection(connectionString);
DataTable dt = new DataTable("Results");
OleDbDataAdapter da = new OleDbDataAdapter(sql, conn);
da.Fill(dt);
return dt;
}
}
public partial class Drillthrough
{
public static string CurrentCellAttributes()
{
// start with empty string
string coordinate = String.Empty;
bool first = true;
foreach (Dimension d in Context.CurrentCube.Dimensions)
{
// skip measures
if (d.DimensionType == DimensionTypeEnum.Measure)
continue;
foreach (Hierarchy h in d.AttributeHierarchies)
{
// skip user hierarchies - consider attribute and parent-child hierarchies
// (parent-child is both user and attribute hierarchy)
if (h.HierarchyOrigin == HierarchyOrigin.UserHierarchy)
continue;
if (!first)
coordinate += ",";
first = false;
coordinate += h.CurrentMember.UniqueName;
}
}
return coordinate;
}
}
}
Yes, I was lazy and kept the same namespace... and I only needed two functions so that was all I bothered getting to work. I'm very grateful to you for all the work you have put into this - it was such a simple idea but has so many uses to fill in
the gaps in functionality in SSAS (until Microsoft get round to fixing this).
As I said before, the "using Microsoft.AnalysisServices.AdomdServer" references msmgdsrv.dll v9.0.0.0.
|