Controlling the Creation of Instances of a Rowset or a Dataset

Executing an MDX query can result either in a dataset or in a flattened rowset. The application can control which object (rowset or dataset) can result from a query. The following rules determine the object resulting from ICommand::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 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, a rowset object is created.

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

  3. If the consumer asks for any interface on the rowset object that does not exist on the dataset, 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 the DBPROP_IRowset property to VARIANT_FALSE (or leave it untouched) and ask for an interface on the dataset object.