Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with ICommandText::Execute hoping for an IMDDataset

46 views
Skip to first unread message

Gavin Berry

unread,
Jan 14, 2003, 9:45:10 AM1/14/03
to
Hi,

I'm having a problem understanding the ICommandText::Execute method. I
have read MS OLE DB Programmer's Reference and I think I am doing what
it says to do. I am trying to execute some MDX against MS Analysis
Services and get back an IMDDataSet* from the ICommandText::Execute
method.

However, the ICommandText::Execute method returns a "No Such Interface
supported" error to me.

The MS Prog Ref states in "Controlling the Creation of Instances of a
Rowset or a Dataset" that one must set the DBPROP_IRowset property of
DBPROPSET_ROWSET to VARIANT_FALSE by using
ICommandProperties::SetProperties. I have done this, but the same "No
Such Interface supported" error is still returned.

Curiously, I have found further MS documentation (in the Prog Ref)
stating that the DBPROP_IRowset is read-only and cannot be changed.
This seems to be a contradiction.

Can anyone point out my error?

Here's a snippet of my code.


//==== Set the command properties
DBPROPSET cmdPropset[1];
DBPROP cmdProps[1];
cmdPropset[0].rgProperties = cmdProps;
cmdPropset[0].cProperties = 1;
cmdPropset[0].guidPropertySet = DBPROPSET_ROWSET;

cmdProps[0].dwPropertyID = DBPROP_IRowset;
cmdProps[0].dwOptions = DBPROPOPTIONS_REQUIRED;
cmdProps[0].colid = DB_NULLID;
cmdProps[0].vValue.vt = VT_BOOL;
cmdProps[0].vValue.boolVal = VARIANT_FALSE;

CATCH_COM_ERROR( pUnkCommand->QueryInterface( IID_ICommandProperties,
( void** ) &pICommandProperties ) );
CATCH_COM_ERROR( pICommandProperties->AddRef() );
CATCH_COM_ERROR( pICommandProperties->SetProperties( 1, cmdPropset )
);
//====

----> No COM errors. Everything seems to be Ok.

//==== Set and execute MDX
CATCH_COM_ERROR( pUnkCommand->QueryInterface( IID_ICommandText, (
void** ) &pICommandText ) );
CATCH_COM_ERROR( pICommandText->AddRef() );
CATCH_COM_ERROR( pICommandText->SetCommandText( MDGUID_MDX, MDX ) );
CATCH_COM_ERROR( pICommandText->Execute( NULL,
IID_IMDDataset,
NULL,
NULL,
( IUnknown** )&pIMDDataset ) );
//====

--->The Execute call throws the error stated above.

Also, if I change the requested IID to IID_IRowset (and supply the
corresponding pointer as the last parameter), no error is thrown.

I should point out that I am completely new to OLE DB programming.

Thanks in advance for your help.

George Spofford

unread,
Jan 15, 2003, 2:21:44 PM1/15/03
to
All of the code I have working doesn't bother setting the command properties.

I suspect there is a bug in the OLE DB for OLAP provider in handling command properties,
but I haven't had any need to take it up with MS. One of Microsoft's developers told me in
another newsgroup that asynchronous Execute()s were allowed, but when I set the command
properties accordingly I also get an E_NOINTERFACE error, and I haven't heard more from
them.

HTH

Gavin Berry wrote:

--
George Spofford
Microsoft MVP
Chief Architect / OLAP Solution Provider
DSS Lab
http://www.dsslab.com
geo...@dsslab.com
ISVs & IT organizations: Find out how DSS Lab can speed your development!


Gavin Berry

unread,
Jan 17, 2003, 5:36:52 AM1/17/03
to
George,

Thanks a lot for your comment. I changed my code so that it left all
properties untouched, but I'm afraid the same error presented itself.

Can I ask if your code requests an IID_IMDDataset or an IID_IRowset? I
can only get this working if I request an IID_IRowset from the Execute
method.

Gavin.


George Spofford <geo...@dsslab.com> wrote in message news:<3E25B4C8...@dsslab.com>...

George Spofford

unread,
Jan 17, 2003, 9:23:43 AM1/17/03
to
Requesting IID_IMDDataset.

Have you looked at the C++ sample code in the Samples subdirectory of your AS2K installation?
That will give you an example of working code. I don't know what else you have in your code that
may provoke the error. For example, connecting to the SQL provider instead of the OLAP provider
would certainly give you this error.

HTH

Gavin Berry wrote:

--

Gavin Berry

unread,
Jan 20, 2003, 11:15:16 AM1/20/03
to
George,

Thanks again. This will sound daft, but I never knew about those
samples ... and yes, I have now found the C++ OLE DB for OLAP sample
and it is of great help to me.

I had been solely working from the MS Data Access SDK.

Thanks a lot.


George Spofford <geo...@dsslab.com> wrote in message news:<3E2811EF...@dsslab.com>...

ppavan...@gmail.com

unread,
Oct 4, 2013, 3:19:11 AM10/4/13
to
Hi Gavin Berry,

Can u give me link of that oledb for olap sample code.
0 new messages