此頁沒有內(nèi)容條目
內(nèi)容

Cell 范例

如下代碼演示訪問指定 Cell 的三個方法。該代碼假定在 OLAP 服務器上存在名為 Bobs Video Store 的數(shù)據(jù)源。

Dim cat      As New ADOMD.Catalog

Dim cst      As New ADOMD.Cellset

Dim cll      As ADOMD.Cell

cat.ActiveConnection = "Data Source=Servername;" + _

   "Initial Catalog=Bobs Video Store;Provider=msolap;"

cst.Source = "SELECT [Product Category].MEMBERS ON ROWS," + _

                     "[Store State].MEMBERS ON COLUMNS" + _

               "FROM  [Bobs Video Store]" + _

               "WHERE ([Quantity])"

Set cst.ActiveConnection = cat.ActiveConnection

cst.Open

' 使用序號位置檢索單元。

Set cll = cst(10)

' 使用軸數(shù)值位置檢索單元。

Set cll = cst(2,2)

' 使用成員名檢索單元。

' MSOLAP 提供者不支持該方法,但是對于支持由成員名

' 訪問單元的提供者,該方法可以包括在內(nèi)。

' Set cll = cst("Childrens", "New York State")