MATLAB Answers

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

6 ビュー (過去 30 日間)
James McBrearty
James McBrearty 2019 年 7 月 30 日
コメント済み: Anirudh Singh 2020 年 3 月 27 日
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