Passing an ADO recordset through COM

Hi,
I have a COM component which uese ADO to access & manipulate a database.
I'd like a function like GetCurrentRecordset to return a _Recordset (and not, what I have now a VARIANT with the data in an array)

I've read some things about it, and it seems I have to create a marshaller for the _recordset type, but I don't know how...

I'm using VC++ 6.0, and the msado15.dll for ADO stuff.
nivenAsked:
Who is Participating?
 
mflamConnect With a Mentor Commented:
From http://msdn.microsoft.com/library/welcome/dsmsdn/gui45.htm

Returning a Recordset from C++
Dear Dr. GUI,
How do I return an ADO recordset from a method in a VC++ COM object?

Jim Hocking

Dr. GUI replies:
Returning an ADO recordset from C++ requires that you tweak your IDL a bit. Inside ...
0
 
basantCommented:
Do you want to use Smart Pointers
or using Direct CoCreateInstance Approach. I have the later one.
0
 
mflamCommented:
basant please continue with the approach you have.

Moshe
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
mflamCommented:
From http://msdn.microsoft.com/library/welcome/dsmsdn/gui45.htm

Returning a Recordset from C++
Dear Dr. GUI,
How do I return an ADO recordset from a method in a VC++ COM object?

Jim Hocking

Dr. GUI replies:
Returning an ADO recordset from C++ requires that you tweak your IDL a bit. Inside ...
0
 
nivenAuthor Commented:
I followed that example to the letter, however, the midl compiler is still complaining about:
"_Recordset: undefined symbol"

The msado15.dll is the last importlib statement.
I can use _RecordsetPtr and all the other ADO types in my program ( _Connection etc ).

Should I change something else to the .idl file?
0
 
nivenAuthor Commented:
I followed that example to the letter, however, the midl compiler is still complaining about:
"_Recordset: undefined symbol"

The msado15.dll is the last importlib statement.
I can use _RecordsetPtr and all the other ADO types in my program ( _Connection etc ).

Should I change something else to the .idl file?
0
 
nivenAuthor Commented:
I already found it,
you have to use:
HRESULT GetSet(LPDISPATCH* theSet)
{

   mySet->QueryInterface(IID_IDispatch, (void**) theSet);
}

Thanks for your help tho (you did point me in the right direction)
0
All Courses

From novice to tech pro — start learning today.