Re: Can't iterate through the Measures collection of the CubeDef object

From: Akshai Mirchandani [MS] (akshaim_at_online.microsoft.com)
Date: 06/01/04


Date: Tue, 1 Jun 2004 12:11:26 -0700

Hi Stephen,

There seems to be some confusion in your sample code -- you appear to have
mixed up the object models. The connection you are opening is an
ADODB.Connection which goes to the COM-based ADO object model. Then at the
end you are using Microsoft.AnalysisServices.AdomdClient.Measure which is
from the new .NET based ADOMD object model.

The two are not interchangable. You should create a connection from the
Microsoft.AnalysisServices.AdomdClient namespace and work with that. Don't
bring the ADODB reference into the code at all unless you need it for
something else.

HTH,
Akshai

--
This posting is provided "AS IS" with no warranties, and confers no rights
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"Stephen Miller" <jsausten@hotmail.com> wrote in message
news:cdb404de.0405301925.117f7a99@posting.google.com...
> I want to build a string array of the available Measures. According to
> the ADOMD.NET SDK, I should be able to iterate through the Measures
> collection of the CubeDef object by:
>
>  Dim oCnn As ADODB.Connection = New ADODB.Connection
>  oCnn.Open("Provider=MSOLAP.1;Data
> Source=localhost;Trusted_Connection=yes;")
>  oCnn.DefaultDatabase = "Foodmart 2000"
>
>  Dim oCat As ADOMD.Catalog = New ADOMD.CatalogClass
>  oCat.ActiveConnection = oCnn
>
>  Dim oCube As ADOMD.CubeDef = oCat.CubeDefs("Sales")
>
>  Dim oMeasures As Microsoft.AnalysisServices.AdomdClient.Measure
>  Dim sMeasures() As String
>  Dim iMeasures As Long = -1
>
>  For Each oMeasures In oCube.Measures
>   iMeasures += 1
>   ReDim Preserve sMeasures(iMeasures)
>   sMeasures(iMeasures) = oMeasures.Name
>  Next
>
> However, this throws an error on the 'For Each ...' line, with the
> message:
>
>  "Public member 'Measures' on type 'CubeDef' not found."
>
> What am I doing wrong?
>
> Thanks,


Relevant Pages

  • Re: DAO.TableDefs Collection question.
    ... For example, ODBCDirect supports a QueryDefs ... model for DAO than does JET. ... there are some very nice object model diagrams ... Dim cn As New ADODB.Connection ...
    (microsoft.public.access.modulesdaovba)
  • Re: Opening/Running Word from Excel
    ... application SELECTION applies. ... Since both Word and Excel object models ... Much better would be to work with Word's object model and avoid ... Dim wrdApp As Word.Application ...
    (microsoft.public.word.vba.general)
  • Re: Opening saved Attachments to print
    ... a TIFF file so you can then print it using its automation object model. ... Dim mailcount As Integer ... Dim sFileName As String, sPath As String ...
    (microsoft.public.outlook.program_vba)
  • Re: Loop through the fields in a table to change a property
    ... Roger dot Carlson at Spectrum-Health dot Org ... > Object Model doesn't know anything about the tables. ... > Dim tbl As DAO.TableDef ... I'm using VBA in Access XP with Win 2K. ...
    (microsoft.public.access.queries)
  • Re: AxWebBrowser true document size problem
    ... See the sample code that I provided in my first post. ... expose the offsetHeight or offsetWidth. ... whether it is defined in the Object Model or not. ... >> values is in my C# code not my Javascript. ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)