I need to get the data from an Access table, and after editing it, save it again in the same table. I need to do this with FOR..Next cycles. I currently use VB6, and ADO. I can't do it in VB.net and ADO.net. You could translate these routines from VB.6 to VB for me. Net. At the MSFlexGrid post I use a DataGridView.

 Sub Carica()
       Set RSConti = New ADODB.Recordset
       Set CnnDB = New ADODB.Connection

       CnnDB.CursorLocation = adUseClient
       CnnDB.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Jet OLEDB:Database Password= " & AccessPassword & " ;Data Source=" & indir2
       RSConti.Open "Select * From TabA", CnnDB, adOpenStatic, adLockOptimistic

     **With MSFlexGrid1
       For numRow = 0 To .Rows - 1
        For numCol = 0 To .Cols - 1
         .TextMatrix(numRow, numCol) = RSConti.Fields(numCol) & ""
        Next numCol
        RSConti.MoveNext
       Next numRow
     End With**

     RSConti.Close
     Set RSConti = Nothing
    End Sub

    Sub Salva()
       Set RSConti = New ADODB.Recordset
       Set CnnDB = New ADODB.Connection

       CnnDB.CursorLocation = adUseClient
       CnnDB.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database password= " & AccessPassword & ";Data Source=" & indir2
       RSConti.Open "Select * From TabA", CnnDB, adOpenStatic, adLockOptimistic

       **CnnDB.Execute "DELETE * From TabA"
     With MSFlexGrid1
       For numRow = 0 To .Rows - 1
         RSConti.AddNew
         For numCol = 0 To .Cols - 1
           RSConti(numCol) = .TextMatrix(numRow, numCol)
         Next numCol
         RSConti.Update
       Next numRow
     End With**

     RSConti.Close
     Set RSConti = Nothing
    End Sub

0 Answers