Exploring OLAP Cube with Visual Basic - Using VB to Explore the OLAP Cube: Creating a VB Project
(Page 3 of 6 )
Create a standard vb executable project and save it under a suitable name. Here it is called ExploreOlap as shown in this picture.

Add library References
In order to connect to the OLAP server, you need to add references to the Microsoft ActiveX Data Objects 2.6 (recent versions include up to 2.8) library, which should add the msado2.6.tlb (the same as msado15.dll). In order to access the OLAP objects, reference to the Microsoft ActiveX Data Objects (multi-dimensional) 2.6 library should be made, which adds the msadomd.dll to the project as shown below.
At this point it will be very instructive to look at VB's Object Browser as shown in the next picture. The structure of the cube is listed when we access the ADOMD library.

Storing Global Variables in the module
As several of the properties are going to be reviewed programmatically, it will be proper to declare the variables at the module level. Add a module and insert the following declarations using the key word NEW. These variables can be used in the forms to access the properties of the Catalog, the Dimensions, the Level, the Hierarchies, and the Members.
Option Explicit
Public oCn As New ADODB.Connection
Public oCat As New ADOMD.Catalog
Public ocube As ADOMD.CubeDef
Public ocdim As ADOMD.Dimension
Public oprop As ADODB.Properties
Public oLvl As ADOMD.Level
Public ohr As ADOMD.Hierarchy
Public oMem As ADOMD.Members
Next: Properties of the Cube: Properties of Dimensions >>
More Database Articles
More By Jayaram Krishnaswamy