Hello all, I am wondering if somebody can help me with the following
I am writing a program, in C++, which needs to use an MS FlexGrid Control
( via the generated CMSFlexGrid wrapper class ) and the MS ADO Data Control.
I can create both the Data Control, and the FlexGrid Control fine. However,
I when I set the datasource property of the FlexGrid control to the Data
Control, it blows up.
Here is the code I am using....
m_Adodc.Create( NULL, NULL, CRect( 0, 0, 50, 50 ), this, 0);
m_Adodc.SetCursorLocation( adUseClient );
m_Adodc.SetCursorType( adOpenStatic );
m_Adodc.SetCommandType( adCmdText );
m_Adodc.SetRecordSource( "SELECT * FROM Person" );
IDispatch* pDispatch = 0;
if( pDispatch == NULL )
AfxMessageBox( "Not an OLE Control!", MB_ICONERROR );
m_FlexGrid.Create( NULL, WS_VISIBLE, CRect( 50, 50, 100, 100 ), this, 1);
m_FlexGrid.SetDataSource( pDispatch );
This snippet is from the OnCreate method of a CView derived class, in an MFC
program. m_Adodc is a member variable of type CAdodc ( the vis studio
generated wrapper class ), and m_FlexGrid is a member variable of type
CMSFlexGrid ( the other wrapper class ).
I have traced through the execution of this code, and after the call to
QueryInterface, pDispatch does appear to have a valid address ( at the
least, I can definitely say it's not null ).
However, the SetDataSource method, which takes a parameter of type
blows up when it executes.
If anybody can give me any clue on what's causing this, it would be much
Voice Data Solutions
I've changed my e-mail address to foil spammers.
Please remove the "no-spam" portion of
my domain name, to respond via e-mail.