Hello good day,
I'm trying to load some data from a table to a database online.
When I try to do this I get the following error:
"An error has occurred in sub:sincronizar_hc_responsesuccess
android.os.NetworkOnMainThreadException"
This is the code that loads data:
Someone could help me? Thank you
I'm trying to load some data from a table to a database online.
When I try to do this I get the following error:
"An error has occurred in sub:sincronizar_hc_responsesuccess
android.os.NetworkOnMainThreadException"
This is the code that loads data:
B4X:
Sub btnCargarPedidos_Click
Dim req As HttpRequest
Dim Query As String
Dim id As Int
Dim fecha As String
Dim idCliente As Int
Dim usuarioEmpleado As String
Dim estado As String
c=s.ExecQuery("SELECT * FROM pedido")
If c.RowCount>0 Then
For i=0 To c.RowCount-1
c.Position=i
id=c.GetString("id")
fecha=c.GetString("fecha")
idCliente=c.GetString("idCliente")
usuarioEmpleado=c.GetString("usuarioEmpleado")
estado=c.GetString("estado")
Query="INSERT INTO Pedido (id, fecha, idCliente, usuarioEmpleado, estado) VALUES ('" & id & "','" & fecha & "','" & idCliente & "','" & usuarioEmpleado & "','" & estado & "')"
req.InitializePost2("http://167.250.5.13/~distribuidora/paises.php", Query.GetBytes("UTF8"))
hc.Execute(req, 1)
Next
End If
End Sub
Someone could help me? Thank you