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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.