Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordset to anything ADO.NET

Status
Not open for further replies.

dymadarlin

Programmer
Jun 26, 2003
41
CA
I have inherited an application which is done by VB.NET. The programmer has used ADODB and recordset everywhere in the program.

Is there any fast way to convert them all to ADO.NET, dataset, datareader, dataadapter and all that?
 
Not really. The differences in approach are too great for a simple mechanistic approach to work. Why change it anyway? There will be no noticeable difference in performance. If you wish to do it so you can learn more about ADO.NET then you should do it by hand as that way you will gain a proper understanding of ADO.NET.



Bob Boffin
 
Hi Sweetheart
???
I found an article in the MSDN knowledge base and they suggest we do the following:

Public Sub CreateADOdotNetDataset(ByRef dsData As DataSet, ByVal rstData As ADODB.Recordset)
'The Approach will be to convert the ado recordset into a ado.net Dataset
Dim da As New System.Data.OleDb.OleDbDataAdapter
Dim ds As New DataSet
Try

'Convert a ADO Recordset to a ADO.NetDataTable
da.TableMappings.Add("0", "0")
da.Fill(ds, rstData, "0")
dsData = ds


Catch ex As Exception
MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub

I hope this helps!
Len

Quite as a bulldozer mate!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top