Using ADO MD

Analysis Services Programming

Analysis Services Programming

Using ADO MD

The Microsoft® ActiveX® Data Objects (Multidimensional) (ADO MD) library contains a number of objects you can use with PivotTable® Service. The Cellset object allows developers to issue Multidimensional Expressions (MDX) queries against cubes on the Analysis server or local cube files. The CubeDef object enables you to retrieve multidimensional schema information.

To use the ADO MD library independently of the ADO library, use the ActiveConnection property of the Catalog or Cellset objects. For more information, see the ADO MD documentation.

Example

The following code creates a Cellset object and sets the ActiveConnection property to the FoodMart 2000 sample database. It then executes a query against the Sales cube.

Dim MyCellSet As New ADOMD.Cellset
MyCellSet.ActiveConnection = "Provider=msolap; Data Source=LocalHost; Initial Catalog=FoodMart 2000;"
MyCellSet.Source = "select {[Measures].[Unit Sales]} on columns," & _
    "order(except([Promotion Media].[Media Type].members," & _
    "{[Promotion Media].[Media Type].[No Media]}),[Measures].[Unit Sales],DESC) on rows " & _
    "From Sales"
MyCellSet.Open

See Also

Working with OLAP Data

Using ADO