Schema Rowsets

This section describes enhancements to the schema rowsets described in the OLE DB for OLAP section of the OLE DB documentation. These enhancements are provided by Microsoft® SQL Server™ OLAP Services.

This section also provides an example of accessing a schema rowset using Microsoft ActiveX® Data Objects (Multidimensional) (ADO MD) and describes the OLE DB interface used for the same purpose.

Schema rowsets are obtained from of the Session object of OLE DB.

MEMBERS Schema Rowset

Calculated members are exposed in the MEMBERS schema rowset.

Member properties are also exposed in the MEMBERS schema rowset. They appear as columns past the last column described in the OLE DB documentation. They are exposed if only one level is present. Specifically, member properties are exposed if the following values are passed to the MEMBERS schema rowset as restrictions:

and if neither of the following values is passed:

You can use ADO MD to obtain the schema rowset directly.

Example

The following code uses ADO MD to print member properties. This code uses the sample FoodMart database (foodmart.mdb), which is provided with OLAP Services. This code prints to the immediate window the name and properties of every member of the [Product].[Product Name] level in the Sales cube.

Dim cn As ADODB.Connection

Dim ct As ADOMD.Catalog

Dim cb As ADOMD.CubeDef

Dim dm As ADOMD.Dimension

Dim hr As ADOMD.Hierarchy

Dim lv As ADOMD.Level

Dim mb As ADOMD.Member

Dim pr As ADODB.Property

Set cn = New ADODB.Connection

cn.Open "provider=msolap;data source=localhost;Initial Catalog=FoodMart;"

Set ct = New ADOMD.Catalog

Set ct.ActiveConnection = cn

Set cb = ct.CubeDefs("Sales")

Set dm = cb.Dimensions("Product")

Set hr = dm.Hierarchies(0)

Set lv = hr.Levels("Product Name")

For Each mb In lv.Members

    Debug.Print mb.Name

    Debug.Print "----------------"

    For Each pr In mb.Properties

        Debug.Print pr.Name & ":  " & pr.Value

    Next pr

    Debug.Print

Next mb

Accessing Schema Rowsets with OLE DB

You can use the IDBSchemaRowset interface for access to schema rowsets. Client applications can get information about the available cubes, dimensions, hierarchies, levels, members, and member properties.

Because IDBSchemaRowset is an interface on the Session object, the client application needs to have a Session object before it can access metadata. For more information, see the OLE DB documentation.

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.