Microsoft KB Archive/824304

= The Depth property of the Level object always returns -1 =

Article ID: 824304

Article Last Modified on 12/9/2003

-

APPLIES TO


 * Microsoft Data Access Components 2.7
 * Microsoft Data Access Components 2.8

-





SYMPTOMS
The Depth property of an instance of the Level object always returns -1 instead of the actual depth level.



CAUSE
This problem occurs because the code that maps Microsoft SQL Server 2000 Analysis Services internal data types into VARIANT subtypes has changed. The VARIANT subtype that is assigned to the value that represents the depth level has changed. Because the GetSchemaObject method does not support the new subtype for the Depth property, GetSchemaObject ignores the new value and leaves the default value of -1. This value is assigned by the constructor of the Level object.



WORKAROUND
To work around this problem and obtain the actual depth level, use the LevelDepth property of the first member of the Level object. To do so, use the following code: Dim oLevel As ADOMD.Level Dim oMember As ADOMD.Member Dim oCellset As ADOMD.Cellset Dim lMembLvDepth As Long Dim lLevelDepth As Long Dim oCube As ADOMD.CubeDef Set oCatalog = New ADOMD.Catalog oCatalog.ActiveConnection = &quot;Provider=MSOLAP;Data Source=localhost;Initial Catalog=Foodmart 2000&quot; Set oCube = oCatalog.CubeDefs(&quot;Warehouse&quot;) Set oLevel = oCube.GetSchemaObject(adObjectTypeLevel, &quot;[Store].[Store Name]&quot;) Debug.Print oLevel.Members(0).LevelDepth 'This is the suggested workaround



STATUS
Microsoft is aware of this problem. This problem might be fixed in a future version of the products in the &quot;Applies to&quot; section.



MORE INFORMATION
To reproduce this problem, use the following code: Dim oLevel As ADOMD.Level Dim oMember As ADOMD.Member Dim oCellset As ADOMD.Cellset Dim lMembLvDepth As Long Dim lLevelDepth As Long Dim oCube As ADOMD.CubeDef Set oCatalog = New ADOMD.Catalog oCatalog.ActiveConnection = &quot;Provider=MSOLAP;Data Source=localhost;Initial Catalog=Foodmart 2000&quot; Set oCube = oCatalog.CubeDefs(&quot;Warehouse&quot;) Set oLevel = oCube.GetSchemaObject(adObjectTypeLevel, &quot;[Store].[Store Name]&quot;) Debug.Print oLevel.Depth ' This returns -1, which is not the actual depth level

Keywords: kbprb KB824304

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.