From VBA to VB.Net

I wrote a Library in VBA wich make an extensive use of recordsets (ADO and DAO).

Now, I want to write it in VB.NET.
Are there any equivances to recordset in .net ? Or any strongly typed heterogeneous containers ?
I would like to stay away from COM components as much as possible.
LVL 14
Fabrice LambertFabrice LambertAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieAnalyst Assistant Commented:
Fabrice

As far as I'm aware the VB.Net 'equivalent' of an (ADO?) recordset is the (ADO.NET?) DataSet.

There are various ways to get data into a DataSet, I think one of the most common methods would be to use a DataAdapter.
0
Fabrice LambertFabrice LambertAuthor Commented:
Do you have a sample on how to use this ?
0
NorieAnalyst Assistant Commented:
Fabrice

I don't have any examples to hand and when I search all I seem to find is examples for C#.

What database(s) are you dealing with?
0
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
From my experience, a DataTable would be more like an ADO.Recordset. Here's how I open a Datatable against a SQL Server database:

Using con As New SQLConnection(YourconnectString)
  con.Open
  Using cmd As New SQLCommand
    cmd.Connection = con
    cmd.CommandText = "Your SQL Here"
    Using dt As New datatable
      dt.Load(cmd.ExecuteReader)
        For each dtr As Datarow in dt.Rows
          '/ work with each row here
        Next
    End Using
  End Using
End Using

Your "dt" object (the DataTable) would be very much like an ADO or DAO Recordset. It has Rows and Columns, and you can iterate through it. You can Search it using Select (dt.SElect etc etc)

A DataSet is a collection of Datatables.

There's also the OLEDB library, which contains the OLEDBCommand and OLEDBConnection objects. Those could be use, with the appropriate connection string, to connect to an Access database, for example.
0
Fabrice LambertFabrice LambertAuthor Commented:
Fabrice

I don't have any examples to hand and when I search all I seem to find is examples for C#.

What database(s) are you dealing with?
Pretty much any data source (also include text files, and excel worksheets).
0
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You can open any OLE compliant object with the OLEDB namespace. It's the "catchall" for this type of operation. The strongly type namespaces, like SQLConnection, are specific to the platform. If your goal is to handle the greatest number of distinct platforms, then OLEDB would probably be your best choice.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fabrice LambertFabrice LambertAuthor Commented:
Thanks you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.