473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 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 6825
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 save it into a dataset.If there are few html...
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 stream into c#, but the format is wrong. I've tried...
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 compiler says "method name expected" and underlines...
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 cannot convert DataTable to byte. Any help or pointing...
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 show me the syntax? Thanks
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 string. I tried...
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 working on currently is being written in C#. I tried...
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 DataSet, not IEnumerable. I don't know how to...
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) daTicket.Fill(dset, "EmployeeTicket") dt =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.