Hello,
In the article on microsoft : http://msdn2.microsoft.com/en-us/library/aa175980(SQL.80).aspx
It explains how to use ADOMD and ADODB to retreive detailed information for the cell returned from the analysis service. For example, detailed information (such as student ID, First name, last name.., etc) about the student that's in location Cincinnati.
However, this example is quite old and doesn't apply to the new ADOMD.net (Microsoft.AnalysisServices.ADOMDClient). I tried to find any example on the web, but without success.
Is there a way to retrieve underlying detailed information?
Any help is greatly appreciated. Thank you very much,
Annie
Finally, I found some resources online and wrote the following code. It worked for me.
Dim AS_Conn As New ADOMDConnection(ConfigurationManager.AppSettings("OLAPConnection2005"))
AS_Conn.Open()
Dim AS_Comm As New AdomdCommand
Dim dt As new DataTable
Dim dr As DataRow
Dim dc As DataColumn
AS_Comm = AS_Conn.CreateCommand()
AS_Comm.CommandText = strMDX
Using rsDetails As AdomdDataReader = AS_Comm.ExecuteReader()
For intFieldCount As Integer = 0 To rsDetails.FieldCount - 1
dc = New DataColumn(rsDetails.GetName(intFieldCount))
dt.Columns.Add(dc)
Next
While rsDetails.Read
dr = dt.NewRow
For intFieldCount As Integer = 0 To rsDetails.FieldCount - 1
If NOT rsDetails.Item(intFieldCount) Is Nothing AndAlso TRIM(rsDetails.Item(intFieldCount)).Length > 0 Then
dr(intFieldCount) = rsDetails.Item(intFieldCount).ToString()
Else
dr(intFieldCount) = ""
End If
Next
dt.Rows.Add(dr)
End While
End Using
AS_Conn = nothing
No comments:
Post a Comment