I have a Visual C++ .NET function that is calling an unmanaged function that
returns an ADO _Recordset* object. I want to be able to convert that into
an ADO.NET DataSet (or DataTable). I tried to use the OleDbDataAdapter.Fill
method, but I could only get that to work if I gave it an
ADODB::RecordsetClass object. I couldn't figure out how to get an ADO
_Recordset into an ADODB::RecordsetClass.

Any ideas? I don't want to have to rewrite all of our existing unmanaged
code.

- Brad

Re: Convert _Recordset to DataSet/DataTable by Cor

Cor
Sat Jun 25 03:31:27 CDT 2005

B. Salmon,

There is an overloaded fill to make from a recordset a dataset. Be aware
that AFAIK this is all you can do with it.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdataoledboledbdataadapterclassfilltopic1.asp

I hope this helps,

Cor



Re: Convert _Recordset to DataSet/DataTable by B

B
Mon Jun 27 07:08:52 CDT 2005

Cor,
Thanks, but I have already looked at that approach. The problem with that
Fill method is that the method takes a "managed" Recordset. In other words,
I need to add a reference to the ADO COM component so a interop wrapper is
created, ADODB. I can then pass an ADODB::RecordsetClass object into the
Fill. My problem is that I'm in C++ and want to call a method in an
existing library that knows nothing about .Net and is returning a
_Recordset* object. In that case, I haven't figured out a way to make the
_Recordset* object become an ADODB::RecordsetClass object so I can call the
Fill method you refer to.

- Brad

"Cor Ligthert" <notmyfirstname@planet.nl> wrote in message
news:uAUTmBWeFHA.2244@TK2MSFTNGP15.phx.gbl...
> B. Salmon,
>
> There is an overloaded fill to make from a recordset a dataset. Be aware
> that AFAIK this is all you can do with it.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdataoledboledbdataadapterclassfilltopic1.asp
>
> I hope this helps,
>
> Cor
>



Re: Convert _Recordset to DataSet/DataTable by Cor

Cor
Mon Jun 27 07:20:27 CDT 2005

Brad,

Sorry I would not know how to solve your problem, this was all I knowed.
However maybe the dotnet data newsgroup is an alternative when you get no
further answer here..

That newsgroup is in my opinion more dedicated to the recordset.

Creating a DataTable or Dataset is of course a piece of case.

Cor