Is there a better way?

Nate Bross

Well-known member
Joined
Apr 6, 2005
Messages
601
Location
Chicago, IL
I just wanna know if there is a better way to get a recordset into a dataset...

This code works, just wondering if there is something better
Code:
        Dim rsDB2Data  as RecordSet
        sSQL = "Select * from " & sDB2Qual & ".SH_QUOTE"
        Dim ds As New DataSet
        rsDB2Data = AdoDB2Conn.Execute(sSQL)

        Dim oleda As New OleDb.OleDbDataAdapter

        oleda.Fill(ds, rsDB2Data, sDB2Qual & ".SH_QUOTE")

Additionally, is it normal to have my AdoDB.dll in
Code:
C:\Program Files\Microsoft.NET\Primary Interop Assemblies\ADODB.dll
I want to be using ADO.NET, but since its in Interop folder it makes me worried I am using the old COM version.

-Thanks
 
Recordsets are ADO not ADO.Net, the .DLL in the interop folder is a wrapper around the COM ADODB.DLL component.

If you are running the code yourself then you could just use the classes under System.Data.OleDb directly (OleDbConnection, OleDbCommand etc.).
 
So I am calling ADO.NET? And there is not a better way using ADO.NET?

Due to project constraints, I cannot use OleDb, as the DB/2 Drivers are not installed.
 
In you sample the code refering to OleDbDataAdapter and DataSet is ADO.Net code, the Recordset however is just plain old ADO cide.

If you do not have the OleDb drivers for DB2 installed how are you getting the data into an ADODB Recordset? Your code snippet makes it look as though you have them installed as you are using an ADO Connection to execute the SELECT statement.

Alternatively you could use the classes under System.Data.Odbc if you havea DB2 odbc driver installed.
 
Back
Top