I am trying to figure out why when processing a task, my form goes blank.
My program reads the records from database1, then writes a value to database2 and loops until all the records from database1 have been gone through.
I have a basic form set up with a label on it, as well as a button (to execute the code). My code is attached below. (The code snipit picks up after i've filled a dataAdapter with all the inventoryItems from QuickBooks (about 3000 skus))
This code works, and successfully updates Database2, but it takes about 4 minutes to complete, and during that time, nothing is displayed on the form. My buttons, the label for the status - it all clears off the screen. I should be happy to know that at least the main function of the form is working, but I'd like to see the progress so i know how long it will take to finish as well as if there's a problem.
Any ideas? Thanks for your help!
If ds.Tables(0).Rows.Count = 0 Then
'Nothing to Update...
lblStatus.Text = "QuickBooks is reporting there are no items..."
Dim y As Integer = ds.Tables(0).Rows.Count - 1
MsgBox("Number of Records to Update: " & y)
For x = 0 To y
Sql = "Update products set stock = " & ds.Tables(0).Rows(x).Item("QuantityOnHand") & " where sku = '" & ds.Tables(0).Rows(x).Item("Name") & "'"
cmd = New SqlCommand(Sql, sqlConn)
lblStatus.Text = "Now updating record: " & x & " of " & y & "."