472,328 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

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 6684
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: js | last post by:
I'm just wondering if anyone have come across a code that reads an html file,search for <table> tag and convert its contents into a datatable and...
5
by: jk | last post by:
I'm having trouble converting a datatable into xml, with resonse.write to aspx. I'm basically converting vb code that saved a recordset into a...
5
by: Andy Sutorius | last post by:
Hi, I am attempting to convert this vb function to csharp but I am getting stuck on the if statement dt.Rows(iLoop)("FAQCategoryID")). The...
3
by: Rodusa | last post by:
I am looking for an example of how to save a DataTable into Base64 and vice-versa. I tried using Convert.ToBase64String(), but it says that it...
2
by: mimi | last post by:
I would like to convert an arraylist to dataset or datatable so that I can filter or make a select distinct from it. How to do it? Can someone...
12
by: Marc | last post by:
I have used XMLDataToString = DataSetForXML.GetXml() to get an XML string from a dataset. I am looking for a way to create a dataset from this XML...
5
by: manmit.walia | last post by:
Hello All, I am stuck on a conversion problem. I am trying to convert my application which is written in VB.NET to C# because the project I am...
6
by: Nick | last post by:
I have a code that returns data in IList. My webGrid doesn't allow me to sort with IList returned, it say it only suports DataView, DataTable and...
2
by: tabakaka | last post by:
how do i convert dataset to datatable? this is a sample of a dataset: Dim dt As New DataTable daTicket = New SqlDataAdapter(sql, Connect)...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.