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
[quoted text, click to view] "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("tableName",
> 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
>
>
>