- Here you will get details about what information field collection contains[ and how to use it. https://docs.microsoft.com/en-us/office/client-developer/access/desktop-database-reference/fields-collection-ado
- Here in 2nd answer you will get idea about how to access the results after retrieving them by executing SQL command.https://www.mathworks.com/support/search.html/answers/412225-warndlg-sql-statement-for-iscellstr.html?q=&fq=asset_type_name:answer%20category:matlab/data-type-identification&page=1
- Here you will get information about Recordset Object Properties, Methods, and Events. https://docs.microsoft.com/en-us/previous-versions/ms808779%28v%3dmsdn.10%29
- Here you will get information about Field Object, so that you can access them accordingly. https://docs.microsoft.com/en-us/previous-versions/ms808769%28v%3dmsdn.10%29
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
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 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 ActiveX 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!