VB5, VB6Use ADO for Data Transfer
Private Sub ADOdatatransfer()
   'called by method LoadTable. Load data directly from source
   'to destination using ADO
   Dim i As Integer, j As Integer
   On Error GoTo SourceSQLError
   Set rsSource = New ADODB.Recordset
   Set rsDest = New ADODB.Recordset
   rsSource.Open sSourceSelectSQL, connSource, adForwardOnly, adLockReadOnly
   RaiseEvent OnSourceSelectComplete
    
   On Error GoTo DestSQLError
   rsDest.Open sDestSelectSQL, connDest, adOpenStatic, adLockOptimistic
   If lNoOfRowsPerFetch = 0 Then lNoOfRowsPerFetch = NO_OF_ROWS_PER_FETCH
   On Error GoTo UpdateError

   'Uses GetRows to read data efficiently    
   Do While Not rsSource.EOF
      myArray = rsSource.GetRows(lNoOfRowsPerFetch)
      
      If bRequiresTransform Then
         'Call the transformation routine
         RaiseEvent OnTransform(lJobID, sJobName, myArray)
      End If
      
      For j = 0 To UBound(myArray, 2)  
      'rows
         rsDest.AddNew
         For i = 0 To UBound(myArray, 1)  
         'columns
            rsDest.Fields(i) = myArray(i, j)
         Next i
         rsDest.Update
         mlNoOfRowsLoaded = mlNoOfRowsLoaded + 1
         If lDataMovingReportInterval > 0 Then
            If (mlNoOfRowsLoaded Mod _
               lDataMovingReportInterval) = 0 Then
               RaiseEvent OnDataMoving
            End If
         End If
         If mlNoOfRowsLoaded = lMaxRowsToLoad Then
            Exit Do
         End If
      Next j
   Loop

   rsSource.Close
   set rsSource = nothing
   rsDest.Close
   Set rsDest = Nothing
   Exit Sub
'...(Error handling routines)
End Sub

Listing 1 This subroutine uses the ADO GetRows method to get the source data efficiently, and uses ADO to insert it into the destination table.