This is driving me crazy! :BangHead:
I have a tablet app that records sample data. Each record is saved to a cloud MySQL db if there is a internet connection and locally if there is none. When the app loads it checks for the text file that holds any data saved then uploads that to the cloud. Pretty simple... My problem is that when it saves the data from the file the number of records saved in my db is correct but all of the values equals the last line. I step through the loop and the values are coming up correct. This was working fine when I was using HTTP but I had to switch to HttpUtils2 when I added a note field.
here's my code:
I have a tablet app that records sample data. Each record is saved to a cloud MySQL db if there is a internet connection and locally if there is none. When the app loads it checks for the text file that holds any data saved then uploads that to the cloud. Pretty simple... My problem is that when it saves the data from the file the number of records saved in my db is correct but all of the values equals the last line. I step through the loop and the values are coming up correct. This was working fine when I was using HTTP but I had to switch to HttpUtils2 when I added a note field.
here's my code:
B4X:
.
.
.
If netLive = True AND File.Exists(File.DirInternal,"temp.txt") = True Then
reader.Initialize(File.OpenInput(File.DirInternal,"temp.txt"))
ProgressDialogShow("Saving local data to cloud")
line = reader.ReadLine
Do Until line = Null
lines = Regex.Split(",",line)
sPH = lines(0)
sO2 = lines(1)
sSample = lines(2)
sSample_Date = lines(3)
sNotes = lines(4)
sBarrel = lines(5)
savejob.Initialize("local",Me)
savejob.Download2("http://www.xxxxxxxxxx.com/xxxxx.php",Array As String("companyid",companyID,"sample_ph",sPH,"sample_o2",sO2,"sample_taste",sSample,"sample_date",sSample_Date,"sample_notes",sNotes,"sample_barrel",sBarrel))
line = reader.ReadLine
Loop
reader.Close
File.Delete(File.DirInternal,"temp.txt")
ProgressDialogHide
End If
.
.
.
Sub JobDone (Job As HttpJob)
If Job.Success = True Then
Select Case Job.JobName
Case "savejob"
ToastMessageShow("Data saved online.",True)
Case "local"
ToastMessageShow("Local data saved online.",False)
End Select
Else
Msgbox("Error in saving " & Job.ErrorMessage,"ERROR")
End If
Job.Release
End Sub