I have a program which matches inventory from a local DB to my web SQL. Each record takes .3 seconds to update, and I have between 10K and 40K records. Is there a better/faster way to update the sql than what I have done here? I am thinking along the lines of an array so the update sends multiple records at once instead of updating each within the loop?
Code:
Me.Caption = "Hooking up to the Website"
CurrentRecord = 0
If updateUPC.State = 1 Then updateUPC.Close
updateUPC.Open "Select * from isc_products ", con, adOpenKeyset, adLockOptimistic
TotalRecords = updateUPC.RecordCount
Do While Not updateUPC.EOF
CurrentRecord = CurrentRecord + 1
TrackStock = updateUPC!prodinvtrack 'How is inventory Tracked?
Text1.Text = updateUPC!prodname
If TrackStock = 1 And updateUPC!prodcode <> "" Then 'Stock Is tracked by Item
If getUPC.State = 1 Then getUPC.Close
getUPC.Open "Select * from ItemInventory where ItemNumber = " & updateUPC!prodcode & "", adocon, adOpenStatic, adLockOptimistic
If Not getUPC.EOF Then
updateUPC!prodcurrentinv = getUPC!QuantityOnHand
updateUPC!UPC = getUPC!UPC
Text2.Text = updateUPC!prodcurrentinv
If updateUPC!prodcurrentinv <= 0 Then
updateUPC!prodvisible = 0
Else
updateUPC!prodvisible = 1
End If
updateUPC.Update
End If
Text3.Text = CurrentRecord & " of " & TotalRecords
Form1.Refresh
End If
updateUPC.MoveNext
Loop