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
- Next message: JS: "Problems Connecting using ADOMD.NET"
- Previous message: Zach Wells: "Re: Looking for sample code for ADOMD.NET and XMLA"
- In reply to: Stephen Miller: "Can't iterate through the Measures collection of the CubeDef object"
- Messages sorted by: [ date ] [ thread ]
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,
- Next message: JS: "Problems Connecting using ADOMD.NET"
- Previous message: Zach Wells: "Re: Looking for sample code for ADOMD.NET and XMLA"
- In reply to: Stephen Miller: "Can't iterate through the Measures collection of the CubeDef object"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|