473,586 Members | 2,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 OleDbDataAdapte r.Fill
method, but I could only get that to work if I gave it an
ADODB::Recordse tClass object. I couldn't figure out how to get an ADO
_Recordset into an ADODB::Recordse tClass.

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

- Brad
Nov 17 '05 #1
9 6837
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::Recordse tClass 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::Recordse tClass object so I can call the
Fill method you refer to.

- Brad

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:uA******** ******@TK2MSFTN GP15.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
OleDbDataAdapte r.Fill method, but I could only get that to work if I gave
it an ADODB::Recordse tClass object. I couldn't figure out how to get an
ADO _Recordset into an ADODB::Recordse tClass.

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.GetObje ctForIUnknown() into OleDbDataAdapte r.Fill function?
--
Vladimir Nesterovsky
e-mail: vl******@nester ovsky-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::Recordse tClass 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::Recordse tClass object so I can call the
Fill method you refer to.

- Brad

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:uA******** ******@TK2MSFTN GP15.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******@neste rovsky-bros.com> wrote in message
news:uQ******** ******@TK2MSFTN GP14.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
OleDbDataAdapte r.Fill method, but I could only get that to work if I gave
it an ADODB::Recordse tClass object. I couldn't figure out how to get an
ADO _Recordset into an ADODB::Recordse tClass.

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.GetObje ctForIUnknown() into OleDbDataAdapte r.Fill function?
--
Vladimir Nesterovsky
e-mail: vl******@nester ovsky-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
OleDbDataAdapte r.Fill method, but I could only get that to work if I gave
it an ADODB::Recordse tClass object. I couldn't figure out how to get an
ADO _Recordset into an ADODB::Recordse tClass.

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.GetObje ctForIUnknown() into OleDbDataAdapte r.Fill function?
--
Vladimir Nesterovsky
e-mail: vl******@nester ovsky-bros.com
home: http://www.nesterovsky-bros.com
Nov 17 '05 #9
THANK YOU!! That did the trick!

- Brad

"Vladimir Nesterovsky" <vl******@neste rovsky-bros.com> wrote in message
news:uQ******** ******@TK2MSFTN GP14.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
OleDbDataAdapte r.Fill method, but I could only get that to work if I gave
it an ADODB::Recordse tClass object. I couldn't figure out how to get an
ADO _Recordset into an ADODB::Recordse tClass.

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.GetObje ctForIUnknown() into OleDbDataAdapte r.Fill function?
--
Vladimir Nesterovsky
e-mail: vl******@nester ovsky-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
6828
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 tables,then each will be converted into a datatable and added into the same dataset. thanks.
5
52664
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 using streams, datadoc, xmlreader, etc with no success. I need to convert it directly to a string or via a stream, but not in a file. Here's some...
5
4097
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 dt.Rows. I don't understand. Thanks for your help. Function GetSelIndex(CatID as String) as Integer Dim iLoop as Integer
3
5657
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 would be appreciated. Thanks Rod
2
13371
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
23748
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 DataSetForXML.ReadXml(XMLDataToString) but I received error messages. Does anyone know how to do this without creating a file (disk copy) of this XML data? Thanks for your help....
5
2714
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 my best to convert it, but somehow the app does not work. I am also not getting any errors when I complie thus, letting me know I am on the write...
6
16727
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 return the DataSet type when using the following code: ======== this is my interface ====================== namespace...
2
29354
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 = dataset.Tables("EmployeeTicket")
0
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7954
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.