--- title: "CubeDef Example (VBScript) | Microsoft Docs" ms.prod: sql ms.prod_service: connectivity ms.technology: connectivity ms.custom: "" ms.date: "01/19/2017" ms.reviewer: "" ms.topic: conceptual dev_langs: - "VB" helpviewer_keywords: - "ADO MD code examples [ADO MD], VBScript" ms.assetid: 4d72a912-ef53-4989-9fca-214937574116 author: MightyPen ms.author: genemi --- # CubeDef Example (VBScript) This example displays cube metadata on a web page. ``` <%@ Language=VBScript %> <% Response.Buffer=True 'Response.Expires=0 %> <% Server.ScriptTimeout=360 Dim cat,cdf,di,hi,le,mem,strServer,strSource,strCubeName '************************************************************************ '*** Set Session Variables '************************************************************************ Session("CubeName") = Request.Form("strCubeName") Session("CatalogName") = Request.Form("strCatalogName") Session("ServerName") = Request.Form("strServerName") Session("chkDim") = Request.Form("chkDimension") Session("chkHier") = Request.Form("chkHierarchy") Session("chkLev") = Request.Form("chkLevel") '************************************************************************ '*** Create Catalog Object '************************************************************************************ Set cat = Server.CreateObject("ADOMD.Catalog") If Len(Session("ServerName")) > 0 Then cat.ActiveConnection = "Data Source=" & Session("ServerName") & ";Initial Catalog=" & Session("CatalogName") & ";Provider=msolap;" Else '************************************************************************************ '*** Must set OLAPServerName to OLAP Server that is '*** present on network '************************************************************************ OLAPServerName = "Please set to present OLAP Server" cat.ActiveConnection = "Data Source=" & OLAPServerName & _ ";Initial Catalog=FoodMart;Provider=msolap;" Session("ServerName") = OLAPServerName Session("InitialCatalog") = "FoodMart" End if If Len(Session("CubeName")) > 0 Then Set cdf = cat.CubeDefs(Session("CubeName")) Else Set cdf = cat.CubeDefs("Sales") Session("CubeName")="Sales" End if '************************************************************************ '*** Collect Information in HTML Form '************************************************************************ %>
Olap Server name:
" size="20">
Catalog Name:
" size="20">
Cube Name:
" size="20">
Add Property Detail:
Dimension Detail:
Hierarchy Detail:
Level Detail:
<% '************************************************************************ '*** Start of Report '************************************************************************ Response.Write "

Report for " & Session("CubeName") & " Cube

" Response.Write "
    " '************************************************************************ '*** Show properties of Cube '************************************************************************ For i = 0 To cdf.Properties.Count - 1 Response.Write "
  1. " Response.Write "" & cdf.Properties(i).Name & ": " & cdf.Properties(i).Value & "" Next Response.Write "
" Response.Write "" %> ```