Problems retrieving the Fields in a recordset obtained from Analysis Services/SQL Server

13 views (last 30 days)
We have started to move data from SQL Server to Analysis Services, and we are using the ActiveX methods to obtain the data from it.
The code we have at the minute is as follows:
conn = actxserver('ADODB.Connection');
conn.Open(strcat('Provider=msolap;Data Source=OurDataSource;',...
'Initial Catalog=OurCatalog;Integrated Security=SSPI;'));
query = char(strcat('DAX query'));
rs = conn.Execute(query).GetRows';
This returns the data that we need in a cell array (Note, server configurations and query is excluded), rs, however the headers of the cell array are rs1, rs2 etc. When we try and drill down into the rs.Fields before the query is run against it, i.e just creating the record set:
rs = actxserver('ADODB.Recordset');
We get a Record Set object as follows:
If we try and get the fields from this we get 'Interface.Microsoft_ActiveX_Data_Objects_6.1_Library.Fields'.
Does anyone know what the issue here is? I know I have that the library on my computer as when I'm on VBA it is one of the references, although it is not clicked. Is there anyway I can add this programmatically?
Many Thanks,
  1 Comment
Anirudh Singh
Anirudh Singh on 27 Mar 2020
I understand that you are able to make a connection with database and retrieve the results successfully, but after creating Recordset you are not able to access the correct value inside the result field collection.
I am attaching a few links for refences which will resolve your issue:

Sign in to comment.

Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by