Click here to Skip to main content
15,879,184 members
Articles / Programming Languages / C#
Article

ADOMD.NET DataAdapter / DataReader replacement

Rate me:
Please Sign up or sign in to vote.
3.36/5 (6 votes)
4 Oct 20051 min read 51.6K   776   26   2
This code replaces the buggy ADOMD.NET DataAdapter and DataReader.

Introduction

This code replaces the exceptionally buggy ADOMD.NET DataReader and DataAdapter classes.

Background

I am writing reports in ActiveReports for .NET and am currently porting a large set of reports to Analysis Services and MDX. In the process, I started out using the ADOMD data provider through the ADO data adapter. I discovered that this interface has a bug where you cannot query properties of parent-child dimensions. This was reported to MS and after 2 months of trying to get them to confirm it, they finally confirmed that it was a bug and they have no plans to fix it. This bug also appears in ADOMD.NET. After discovering that you also cannot query intrinsic properties of the measures dimension, I decided that I needed to write my own data provider. I started out using the ADOMD.NET Cellset as the data source, but that has a bug where it will crash on certain queries with a DuplicateNameException (reported to MS, no response yet). I then switched to using ADOMD through COM interop. All of the classes except MyMdDataReader are simple shells and not very interesting. Most of the functionality is enclosed in the MyMdDataReader.

Using the code

This is a direct drop-in replacement for ADOMD.NET if you need to use a DataReader or fill a DataSet from an MDX expression. Just replace references to AdomdDataReader, AdomdDataAdapter, AdomdConnection and AdomdCommand with MyMdDataReader, MyMdDataAdapter, MyMdConnection, and MyMdCommand respectively.

As far as I have tested this, it works with all MDX queries and will return the same column names as the AdomdDataReader. In addition it will return queried parent-child dimension properties, and the following intrinsic properties for all dimensions on the Y axis; CAPTION, CHILD_COUNT, LEVEL_DEPTH, LEVEL_NAME, NAME, UNIQUE_NAME.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questiondata reader replacement Pin
rob boree24-Aug-11 8:21
rob boree24-Aug-11 8:21 
GeneralImprovement Pin
wekrato1-Feb-06 2:49
wekrato1-Feb-06 2:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.