By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,571 Members | 1,659 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,571 IT Pros & Developers. It's quick & easy.

Issue with DAO to ADO.Net

P: n/a
LDD
Hey folks

I'm porting an app from VB6 to VB.Net... what a process!

I'm about 70% of the way through.

However I'm trying to find some information on how to upgrade the code
snippet below to make use of ADO.Net

-----------------------------------------------------
....
Dim prsFiles As DAO.Recordset

prsFiles = frmMain.DefInstance.getDatabase.OpenRecordset("tab leName",
DAO.RecordsetTypeEnum.dbOpenDynaset)

End Select

prsFiles.AddNew()

prsFiles.Fields("FileName").Value = vsfilename

prsFiles.Update()

prsFiles.Close()

-----------------------------------------------------
The subroutine gets called from within a loop.

How do I modify the code to use ado.net/
Or if there is any clear documentation with samples, that would be cool to..

thanks

LDD

Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
LDD,

In my opinon the only answer can be in my opinion. Buy a book about ADONET.

Very known in these newsgroups are Sceppa and Vaughn as they are active in
these newsgroups.

microsoft.public.dotnet.framework.ADONET

Your question is to general and needs to much extra information for a
newsgroup message.

Sorry

Cor

"LDD" <la***************@gmail.com> schreef in bericht
news:7u********************@magma.ca...
Hey folks

I'm porting an app from VB6 to VB.Net... what a process!

I'm about 70% of the way through.

However I'm trying to find some information on how to upgrade the code
snippet below to make use of ADO.Net

-----------------------------------------------------
...
Dim prsFiles As DAO.Recordset

prsFiles = frmMain.DefInstance.getDatabase.OpenRecordset("tab leName",
DAO.RecordsetTypeEnum.dbOpenDynaset)

End Select

prsFiles.AddNew()

prsFiles.Fields("FileName").Value = vsfilename

prsFiles.Update()

prsFiles.Close()

-----------------------------------------------------
The subroutine gets called from within a loop.

How do I modify the code to use ado.net/
Or if there is any clear documentation with samples, that would be cool
to..

thanks

LDD

Nov 21 '05 #2

P: n/a
If you only have a very small amount of code to port and it doesn't use
databinding then you can use "classic" ADO from VB.NET - just add a
reference to ADODB.dll and start using the objects. You might also be
able to use DAO via COM interrop - but ADO is pretty similar in usage
to DAO.

If you have a large amount of this type of code to port and your
project uses a lot of databinding then you might want to consider
Infralution's Virtual Data Objects. This allows you to use classic
ADODB with ADO.NET databinding and can take a lot of the pain out of
porting a large application. You can download a fully functional
evaluation version at:

www.infralution.com/virtualdata.html

Grant Frisken
Infralution

Nov 21 '05 #3

P: n/a
Here's part of your conversion. This is an application that was in VB6 using
DAO which I've converted to VB.NET using ADO. The app uses the data from the
table to fill in a grid for viewing purposes.

Original DAO code:

Dim dbSteel As Database
Dim rsAK As DAO.Recordset
Set dbSteel = OpenDatabase("AKSteelEpstienValues.mdb")
Sql = "Select * from AKSteelData order by coil"
rsAK = dbSteel.OpenRecordset(Sql, DAO.RecordsetTypeEnum.dbOpenDynaset)

Coverted ADO code:

Dim sql As String
Dim da As OleDbDataAdapter
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim Roll As DataSet
Me.MdiParent = CoreInfo.MDIForm1.ActiveForm
Cursor.Current = Cursors.WaitCursor
sql = "Select * from AKSteelData order by coil"
con = New OleDbConnection(OptAKCnn)
cmd = New OleDbCommand
da = New OleDbDataAdapter
cmd.Connection = con
cmd.CommandText = sql
cmd.CommandType = CommandType.Text
con.Open()
Roll = New DataSet
da.SelectCommand = cmd
da.Fill(Roll, "AKSteelData")
DataGrid1.DataSource = Roll.Tables("AKSteelData")
con.Close()
con.Dispose()
Cursor.Current = Cursors.Default


"LDD" wrote:
Hey folks

I'm porting an app from VB6 to VB.Net... what a process!

I'm about 70% of the way through.

However I'm trying to find some information on how to upgrade the code
snippet below to make use of ADO.Net

-----------------------------------------------------
....
Dim prsFiles As DAO.Recordset

prsFiles = frmMain.DefInstance.getDatabase.OpenRecordset("tab leName",
DAO.RecordsetTypeEnum.dbOpenDynaset)

End Select

prsFiles.AddNew()

prsFiles.Fields("FileName").Value = vsfilename

prsFiles.Update()

prsFiles.Close()

-----------------------------------------------------
The subroutine gets called from within a loop.

How do I modify the code to use ado.net/
Or if there is any clear documentation with samples, that would be cool to..

thanks

LDD

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.