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("A KSteelEpstienVa lues.mdb")
Sql = "Select * from AKSteelData order by coil"
rsAK = dbSteel.OpenRec ordset(Sql, DAO.RecordsetTy peEnum.dbOpenDy naset)
Coverted ADO code:
Dim sql As String
Dim da As OleDbDataAdapte r
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim Roll As DataSet
Me.MdiParent = CoreInfo.MDIFor m1.ActiveForm
Cursor.Current = Cursors.WaitCur sor
sql = "Select * from AKSteelData order by coil"
con = New OleDbConnection (OptAKCnn)
cmd = New OleDbCommand
da = New OleDbDataAdapte r
cmd.Connection = con
cmd.CommandText = sql
cmd.CommandType = CommandType.Tex t
con.Open()
Roll = New DataSet
da.SelectComman d = cmd
da.Fill(Roll, "AKSteelDat a")
DataGrid1.DataS ource = Roll.Tables("AK SteelData")
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.DefInst ance.getDatabas e.OpenRecordset ("tableName" ,
DAO.RecordsetTy peEnum.dbOpenDy naset)
End Select
prsFiles.AddNew ()
prsFiles.Fields ("FileName").Va lue = 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