Controlling the Creation of Instances of a Rowset or a Dataset

Executing an MDX query can either result in a dataset, or it can result in the flattened rowset. The application can control which object (rowset or a dataset) can result from a query. The following rules determine the object resulting from ICommandText::Execute when the GUID specified in the rguidDialect argument of ICommandText::SetCommandText is MDGUID_MDX. (The provider applies the following rules in the sequence shown below, and exits if any rule is satisfied.)

  1. If the consumer has set the property DBPROP_IRowset to VARIANT_TRUE in the property set DBPROPSET_ROWSET by using ICommandProperties::SetProperties, then a Rowset object is created.

  2. If the consumer asks for any interface on the Dataset object, then a Dataset object is created.

  3. If the consumer asks for any interface on the Rowset object that does not exist on the dataset, then a Rowset object is created.

Therefore, the guaranteed way for a consumer to get the flattened rowset of a dataset is by setting the DBPROP_IRowset property to VARIANT_TRUE. The guaranteed way for a consumer to get a dataset is to set DBPROP_IRowset property to VARIANT_FALSE (or leave it untouched) and ask for an interface on the Dataset object.