动态生成MDX查询

MeasureList , 度量列表

DimensionList , 维度列表

AttributeList, 属性列表

 

for (int m = 0; m < MeasureList.Length; m++)
{
measureAll += @"([Measures].[" + MeasureList[m] + @"])";
if (!(m == MeasureList.Length - 1))
measureAll += @",";
}

for (int d = 0; d < DimensionList.Length; d++)
{
dimensionAll += @"[" + DimensionList[d] + @"].[" + AttributeList[d] + @"].AllMembers";
if (!(d == DimensionList.Length - 1))
dimensionAll += @",";
}

finalQuery = @"SELECT {" + measureAll + "} on Columns , {(" + dimensionAll + ")} ON rows FROM [Analysis Service Demo]";

posted on 2011-03-08 10:28  黑头  阅读(382)  评论(0编辑  收藏  举报

导航