CubeDef 范例

目录

如下代码范例演示如何访问 CubeDefsDimensions 集合。该范例打印立方中每个维的名称。该代码假定在名为 Servername 的 OLAP 服务器上存在名为 Bobs Video Store 的数据源。

Dim cat      As New ADOMD.Catalog
Dim cdf      As ADOMD.CubeDef
Dim I         As Integer
cat.ActiveConnection = "Data Source=Servername;" + _
   "Initial Catalog=Bobs Video Store;Provider=msolap;"
Set cdf = cat.CubeDefs("Bobs Video Store")
For i = 0 To cdf.Dimensions.Count - 1
   Debug.Print cdf.Dimensions(i).Name
Next
www.holmesian.org