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

2 次查看(过去 30 天)
Hi,
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,
James
  1 个评论
Anirudh Singh
Anirudh Singh 2020-3-27
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:

请先登录,再进行评论。

回答(0 个)

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by