Databases Reference
In-Depth Information
.
ParentDimension
.
DefaultMember
.
DisplayFolder
.
Caption
.
HierarchyOrigin
.
Levels
.
Properties
The code in Listing 33.22 demonstrates a simple way of accessing properties that are not
part of the multidimensional result returned by the server.
LISTING 33.22
Fetching Object Properties That Are Not Part of a Multidimensional Result
//Open a connection to the server.
AdomdConnection con = new AdomdConnection(“Datasource=localhost; Initial
Catalog=Foodmart 2008;”);
con.Open();
//Execute a simple MDX statement.
AdomdCommand command = con.CreateCommand();
command.CommandText = “SELECT Measures.Members ON COLUMNS FROM [Warehouse and
Sales]”;
//Execute the command and get the CellSet object.
CellSet cellSet = command.ExecuteCellSet();
//Iterate the axes and their hierarchies and get properties of each hierarchy.
foreach(Axis axis in cellSet.Axes)
{
foreach(Hierarchy hier in axis.Set.Hierarchies)
{
Console.WriteLine(hier.Caption);
Console.WriteLine(hier.Description);
}
}
//Close the connection.
con.Close();
You probably have already noticed that the Member object differs from other objects in the
object model. The main difference is the possible number of members in the collection.
There are usually many more members in the system than there are hierarchies or levels,
so sending a round-trip request to the server to bring additional properties of each
member can cause severe performance problems.
 
Search WWH ::




Custom Search