Android Question RDC multiple insert records?

Heppy

Active Member
Licensed User
Longtime User
Hi for all

B4X:
Sub JobDone(Job As HttpJob)
   If Job.Success = False Then
     Log("Error: " & Job.ErrorMessage)
   Else
    ToastMessageShow("Espere a que salga cartel FINALIZADO", True)
     Dim i As Int
     Dim t, s, ss As String
     Dim n, z As Int

     sql1.ExecNonQuery("DELETE From Instalacion")
     lblOp.Text="Instalaciones Borradas"
     If Job.JobName = "DBRequest" Then
       Dim result As DBResult = reqManager.HandleJob(Job)
       For Each records() As Object In result.Rows
        i=records(0)
        t=records(1)
        n=records(2)
        s=records(3)
        z=records(4)
        sql1.ExecNonQuery("INSERT INTO Instalacion (ID,Tipo,Numero,Situacion,Zona) VALUES('"&i&"','" & t & "','" & n & "','" & s & "','" & z & "')")
        Log("Insertando tipo: "&t&" y número: "&n)
       Next
       'reqManager.PrintTable(result)
     End If
   End If
   lblOp.Text="FINALIZADO"
   Job.Release
End Sub

Is there any way to do this once?, for example, I do it in Delphi:

INSERT INTO Table Select * field1,field2,....... from Table2

And in Reverse mode? Local->Server RDC?

Thanks and regards
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It depends on the which SQL engine you are using. If the SQL statement is supported by the SQL then you can use it with RDC. You just need to set it like you set any other statement in the config file.

SQLite does support this format. It should work. Note that you should use ExecNonQuery2 instead of ExecNonQuery. It will be much easier to build the query and you will not need to worry about escaping the strings (and SQL injection).
 
Upvote 0
Top