Using the OLE DB Command Object

After you have created an MDX statement that represents the desired dataset, the next step is to submit the query for execution. OLE DB for OLAP uses the existing infrastructure in OLE DB for query execution. This infrastructure takes the form of the command object. The command object exposes an interface called ICommandText, which has the following methods that, when used with the ICommand methods, provide the ability to execute queries:

Execution of an MDX statement usually results in the creation of a dataset, unless the application chooses to ask for a rowset object to be created (which represents a flattened dataset). For more information, see Flattening a Dataset to Produce a Rowset.