Click to See Complete Forum and Search --> : RDS Business Objects in VC++?


zero1143
September 7th, 2000, 08:34 AM
I have a VB custom business object that contains one method:
Public Function Execute(strConnect As String) As ADODB.Recordset

I can successfully invoke this method from a VC object using:
COleDispatchDriver disp(p_pDFactory);
IDispatch* res;
static BYTE parms[] = VTS_PBSTR;
disp.InvokeHelper(p_ExecuteDispID,
DISPATCH_METHOD, VT_DISPATCH,
(void*)res,
parms,&bstrConnect);
and a detached ADO recordset reference is returned in "res"

I have a similar custom business object written in C++ with a method:
STDMETHODIMP CMBCServerConnection::Execute(/*[in,out]*/BSTR*
p_bstrConnString, /*[out,retval]*/_Recordset **p_ppAdoRecordset)

when called by the same VC code above it fails to call the business
object and returns a "type mismatch" hresult.

When viewed by Ole Viewer the two interfaces appear to be virtually
identical.

Can anyone offer any insights as to what the problem might be??

Here are the interface displays from Ole Object Viewer

VB interface display-----------------------------------
// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: MBCDBServer.dll

[
uuid(568992B2-A22B-4C40-BB8B-D20CA21D8F38),
version(1.0)
]
library MBCDBServerX
{
// TLib : // TLib : Microsoft ActiveX Data Objects 2.5
Library : {00000205-0000-0010-8000-00AA006D2EA4}
importlib("msado15.dll");
// TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
importlib("stdole2.tlb");

// Forward declare all types defined in this typelib
interface _MBCServerConnection;

[
odl,
uuid(4013351D-6578-4E47-850C-E89E4E6730C3),
version(1.0),
hidden,
dual,
nonextensible,
oleautomation
]
interface _MBCServerConnection : IDispatch {
[id(0x60030000)]
HRESULT Execute(
[in, out] BSTR* strConnect,
[out, retval] _Recordset** );
};

[
uuid(5D4C0583-AD81-47CD-932E-4D075125BB06),
version(1.0)
]
coclass MBCServerConnection {
[default] interface _MBCServerConnection;
};
};

VC interface display-----------------------------------------
// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: MBCDBServer.dll

[
uuid(9A46F426-D545-4C75-8C2F-72A8DEA52B53),
version(1.0),
helpstring("MBCDBServer 1.0 Type Library")
]
library MBCDBSERVER
{
// TLib : // TLib : Microsoft ActiveX Data Objects 2.5
Library : {00000205-0000-0010-8000-00AA006D2EA4}
importlib("msado15.dll");
// TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
importlib("stdole2.tlb");

// Forward declare all types defined in this typelib
interface IMBCServerConnection;

[
odl,
uuid(DE52DBE4-04B6-4919-8581-2D321889EE4D),
helpstring("IMBCServerConnection Interface"),
dual,
nonextensible,
oleautomation
]
interface IMBCServerConnection : IDispatch {
[id(0x00000001), helpstring("method Execute")]
HRESULT Execute(
[in, out] BSTR* pbstrConnection,
[out, retval] _Recordset** pAdoRecset);
};

[
uuid(78D3586B-1FE2-442D-9BAC-88FDA44CF272),
helpstring("MBCServerConnection Class")
]
coclass MBCServerConnection {
[default] interface IMBCServerConnection;
};
}

Zhuoran
September 28th, 2000, 06:02 AM
Sorry,my english is very pool,because i'm a chinese.

I have just write a RDS business object use VC,
i think ,you must use IDispatch in client,the use Queryinterface method to get IRecordset.

if that is something wrong above,Please tell me why after you correct problem,thanks.

By the way:I have some problem when i write this business object,can i remit to you?

……………………………………………………………………………………
.--.
/.-. '----------.
\'-' .--"--""-"-'
'--'
……………………………………………………………………………………