Hi,
I am using PostString within a loop. The server receives the correct counts of posts, but all have the last command.
I check using Log(..) the command given: They are correct.
I check the receive on the server-side: They all are the last command.
Could it be a timing issue?
This is what I am using:
Can someone tell me what is wrong?
Best regards,
André
I am using PostString within a loop. The server receives the correct counts of posts, but all have the last command.
I check using Log(..) the command given: They are correct.
I check the receive on the server-side: They all are the last command.
Could it be a timing issue?
This is what I am using:
B4X:
Sub InsertMaps(TableName As String, ListOfMaps As List)
Dim columns, values As StringBuilder
Dim Commando As String
Opslaan.Release
Opslaan.JobName = TableName
AantalTeVerzenden=ListOfMaps.Size-1
Try
For i1 = 0 To ListOfMaps.Size - 1
columns.Initialize
values.Initialize
Commando="INSERT INTO " & TableName & " ("
Dim l As Map
l.Initialize
l = ListOfMaps.Get(i1)
For i2 = 0 To l.Size - 1
Dim col As String
Dim value As Object
col = l.GetKeyAt(i2)
value = l.GetValueAt(i2)
If i2 > 0 Then
columns.Append(", ")
values.Append(", ")
End If
columns.Append(col)
If value <> Null Then
values.Append(Chr(34)).Append(value).Append(Chr(34))
Else
values.Append(value)
End If
Next
Commando = Commando &columns.ToString&") VALUES ("&values.ToString&");"
Log(Commando)
Opslaan.PostString(Main.MainUrl&"&target=action",Commando)
Next
Catch
Fouten = True
End Try
End Sub
Sub JobDone (Job As HttpJob)
If (Job.Success == True) Then
If(Job.JobName == "werktijden") Then
TellerVerzending=TellerVerzending+1
If(TellerVerzending==AantalTeVerzenden) Then
Log("UPDATE ["&(Main.DBWerkdagen)&"] SET [Verzonden] = 1 WHERE Verzonden=0")
Main.SQL1.ExecNonQuery("UPDATE ["&(Main.DBWerkdagen)&"] SET [Verzonden] = 1 WHERE Verzonden=0")
Msgbox("Alles is verzonden", "")
Job.Release
Activity.Finish
End If
End If
If(Job.JobName == "werkdagen") Then
TellerVerzending=TellerVerzending+1
If(TellerVerzending==AantalTeVerzenden) Then
TellerVerzending=0
Verzend_Werktijden
End If
End If
Else
ToastMessageShow("Fout: " & Job.ErrorMessage, True)
Fouten = True
End If
End Sub
Can someone tell me what is wrong?
Best regards,
André
Last edited: