Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mihies
New Member

Getting field datatypes from an SQL Analysis Services MDX SELECT query using .NET AdomdClient

Let's say I have this MDX query against SQL Server's Analysis Service Adventure Works sample:

select [Measures].[Customer Count] on columns, 
[Date].[Calendar Quarter of Year] on rows
from [Adventure Works]

And I execute it as:

var reader = new AdomdCommand("...").ExecuteReader();

I would expect that

reader.GetFieldType(0);

would return System.Int32, but it returns System.Object. The same is true if I query schema with reader.GetSchemaTable() which is no surprise as I assume the former gets data from later. I also assume this is probably not an exclusive .NET issue. The same is at least true for .NET Framework.

So, is there a way I can get those types when I do a query?

2 REPLIES 2
mihies
New Member

I guess it's related to both and I don't think Adomd client is doing anything significant except for retrieving schema from SQL server. But anyway, I will post there as well.

v-shex-msft
Community Support
Community Support

Hi @mihies,

According to your description, I think this requirement is more related to use ADO.NET to getting data from SQL server.

For this scenario, I'd like to suggest you post those at the forum to get further support.

.NET - Microsoft Q&A

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.