469,927 Members | 1,770 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Convert _Recordset to DataSet/DataTable

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
Nov 17 '05 #1
9 6284
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/de...filltopic1.asp

I hope this helps,

Cor
Nov 17 '05 #2
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" <no************@planet.nl> wrote in message
news:uA**************@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/de...filltopic1.asp

I hope this helps,

Cor

Nov 17 '05 #3
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
Nov 17 '05 #4
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.


Did you try to pass your native _Recordset converted to object with
Marshal.GetObjectForIUnknown() into OleDbDataAdapter.Fill function?
--
Vladimir Nesterovsky
e-mail: vl******@nesterovsky-bros.com
home: http://www.nesterovsky-bros.com
Nov 17 '05 #5
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" <no************@planet.nl> wrote in message
news:uA**************@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/de...filltopic1.asp

I hope this helps,

Cor

Nov 17 '05 #6
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
Nov 17 '05 #7
THANK YOU!! That did the trick!

- Brad

"Vladimir Nesterovsky" <vl******@nesterovsky-bros.com> wrote in message
news:uQ**************@TK2MSFTNGP14.phx.gbl...
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.


Did you try to pass your native _Recordset converted to object with
Marshal.GetObjectForIUnknown() into OleDbDataAdapter.Fill function?
--
Vladimir Nesterovsky
e-mail: vl******@nesterovsky-bros.com
home: http://www.nesterovsky-bros.com

Nov 17 '05 #8
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.


Did you try to pass your native _Recordset converted to object with
Marshal.GetObjectForIUnknown() into OleDbDataAdapter.Fill function?
--
Vladimir Nesterovsky
e-mail: vl******@nesterovsky-bros.com
home: http://www.nesterovsky-bros.com
Nov 17 '05 #9
THANK YOU!! That did the trick!

- Brad

"Vladimir Nesterovsky" <vl******@nesterovsky-bros.com> wrote in message
news:uQ**************@TK2MSFTNGP14.phx.gbl...
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.


Did you try to pass your native _Recordset converted to object with
Marshal.GetObjectForIUnknown() into OleDbDataAdapter.Fill function?
--
Vladimir Nesterovsky
e-mail: vl******@nesterovsky-bros.com
home: http://www.nesterovsky-bros.com

Nov 17 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by jk | last post: by
5 posts views Thread by Andy Sutorius | last post: by
3 posts views Thread by Rodusa | last post: by
12 posts views Thread by Marc | last post: by
5 posts views Thread by manmit.walia | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.