I have the following MySQL Function that I use to copy my Product table from the Server to the Local System's database
Dim DataResult As Result
Global.DisplaySystemMessage("Processing Please wait...")
i = 1
$Query = Null
$Query &= "Select "
$Query &= "barcodenumber, "
$Query &= "posdescription, "
$Query &= "shelfedgelabeldescription, "
$Query &= "salelocation, "
$Query &= "subcatnumber, "
$Query &= "agerestricted, "
$Query &= "agelimit, "
$Query &= "pricetype, "
$Query &= "retailprice, "
$Query &= "retailvatprice, "
$Query &= "vatcode, "
$Query &= "stockcontrolyn, "
$Query &= "trackcolor, "
$Query &= "tracksize, "
$Query &= "print_guarantee_message, "
$Query &= "print_guarantee_code, "
$Query &= "displaymessage, "
$Query &= "messagenumber, "
$Query &= "sendtoppr, "
$Query &= "requestserial, "
$Query &= "itemnotallowed, "
$Query &= "itemnotallowed_reason, "
$Query &= "restrict_product_qty, "
$Query &= "product_qty_allowed, "
$Query &= "discount_not_allowed, "
$Query &= "no_refund_allowed, "
$Query &= "healthy_start_voucher_ok, "
$Query &= "ask_for_qty_before_selling, "
$Query &= "priceoverride_not_allowed "
$Query &= "from producttable "
$Query &= "order by barcodenumber ASC;"
DataResult = Global.$DBCon.Exec($Query)
If DataResult.Available = True Then
Global.AddToListBox("Downloading data from the product table")
With FMain.ProgressBar1
.Value = 1
.Visible = True
End With
For Each DataResult
LocalSQL = Null
LocalSQL &= "Insert into producttable ("
LocalSQL &= "barcodenumber, "
LocalSQL &= "posdescription, "
LocalSQL &= "shelfedgelabeldescription, "
LocalSQL &= "salelocation, "
LocalSQL &= "subcatnumber, "
LocalSQL &= "agerestricted, "
LocalSQL &= "agelimit, "
LocalSQL &= "pricetype, "
LocalSQL &= "retailprice, "
LocalSQL &= "retailvatprice, "
LocalSQL &= "vatcode, "
LocalSQL &= "stockcontrolyn, "
LocalSQL &= "trackcolor, "
LocalSQL &= "tracksize, "
LocalSQL &= "print_guarantee_message, "
LocalSQL &= "print_guarantee_code, "
LocalSQL &= "displaymessage, "
LocalSQL &= "messagenumber, "
LocalSQL &= "sendtoppr, "
LocalSQL &= "requestserial, "
LocalSQL &= "itemnotallowed, "
LocalSQL &= "itemnotallowed_reason, "
LocalSQL &= "restrict_product_qty, "
LocalSQL &= "product_qty_allowed, "
LocalSQL &= "discount_not_allowed, "
LocalSQL &= "no_refund_allowed, "
LocalSQL &= "healthy_start_voucher_ok, "
LocalSQL &= "ask_for_qty_before_selling, "
LocalSQL &= "priceoverride_not_allowed) "
LocalSQL &= "VALUES ('"
LocalSQL &= DataResult!barcodenumber & "','"
LocalSQL &= Replace(Replace(DataResult!posdescription, "'", "''"), ",", ",,") & "','"
LocalSQL &= Replace(Replace(DataResult!shelfedgelabeldescription, "'", "''"), ",", ",,") & "','"
LocalSQL &= DataResult!salelocation & "','"
LocalSQL &= DataResult!subcatnumber & "','"
LocalSQL &= DataResult!agerestricted & "','"
LocalSQL &= DataResult!agelimit & "','"
LocalSQL &= DataResult!pricetype & "','"
LocalSQL &= DataResult!retailprice & "','"
LocalSQL &= DataResult!retailvatprice & "','"
LocalSQL &= DataResult!vatcode & "','"
LocalSQL &= DataResult!stockcontrolyn & "','"
LocalSQL &= DataResult!trackcolor & "','"
LocalSQL &= DataResult!tracksize & "','"
LocalSQL &= DataResult!print_guarantee_message & "','"
LocalSQL &= DataResult!print_guarantee_code & "','"
LocalSQL &= DataResult!displaymessage & "','"
LocalSQL &= DataResult!messagenumber & "','"
LocalSQL &= DataResult!sendtoppr & "','"
LocalSQL &= DataResult!requestserial & "','"
LocalSQL &= DataResult!itemnotallowed & "','"
LocalSQL &= Replace(Replace(DataResult!itemnotallowed_reason, "'", "''"), ",", ",,") & "','"
LocalSQL &= DataResult!restrict_product_qty & "','"
LocalSQL &= DataResult!product_qty_allowed & "','"
LocalSQL &= DataResult!discount_not_allowed & "','"
LocalSQL &= DataResult!no_refund_allowed & "','"
LocalSQL &= DataResult!healthy_start_voucher_ok & "','"
LocalSQL &= DataResult!ask_for_qty_before_selling & "','"
LocalSQL &= DataResult!priceoverride_not_allowed & "')"
DatabaseFunctions.SendToLocalDatabase(LocalSQL)
Dim RemaingValue As Integer = DataResult.Count - I
FMain.ProgressBar1.Value = i / DataResult.Count
Global.DisplaySystemMessage("Processing Record " & Trim(Format(i, "###,###,##0")) & " of " & Trim(Format(DataResult.Count, "###,###,##0")) & " Reaming to Process " & Trim(Format(RemaingValue, "###,###,##0")))
i += 1
Next
If DataResult.Count = 1 Then
Global.AddToListBox("Downloaded a total of " & DataResult.Count & " record")
Else
Global.AddToListBox("Downloaded a total of " & DataResult.Count & " records")
End If
Else
Global.AddToListBox("Nothing to Download from the product table")
End If
With FMain.ProgressBar1
.Value = 0
.Visible = False
End With
ShowDottedLine
End
Does anyone know how I can show a ETA on the screen (example Processing Record 1 of 12,999 & " Reaming to Process 12,998 (ETA 05:00 Mins)
or could someone point me in the direction so I can read up on how to show a Est time remaining
I was working on 2 seconds a record so that would be 12999 *2 = 25,998 then divide by 60 (minute) = 433.3 would that be mins or hours ?