reading from sqlite and sending data to a webservice

devragland

Member
Licensed User
Longtime User
greetings,


Can anyone please help me with the syntax for the below code? am basically trying to loop through rows in sqlite and send them to a mysql database (i have incorporated the web service and it works fine)

in the below code am trying to read the sqlite db loop through the rows and send each row as in insert quert to the remote database.

Any help would be much appreciated :sign0085:


B4X:
Sub send_server
   Dim Cursor1 As Cursor
   
   Cursor1 = SQL1.ExecQuery("SELECT col1, col2, col3 FROM deparment")
   For i = 0 To Cursor1.RowCount - 1
      Cursor1.Position = i
      
      Log(Cursor1.GetString("col1"))
      Log(Cursor1.GetInt("col2"))
      Log(Cursor1.GetInt("col3"))

      ExecuteRemoteQuery("INSERT INTO department  VALUES (" & Cursor1.GetString("col1") &"," & Cursor1.GetString("col2") &" " & Cursor1.GetString("col3") &")",3)
'      
   Next
   Cursor1.Close
End Sub

changing

B4X:
ExecuteRemoteQuery("INSERT INTO department  VALUES (" & Cursor1.GetString("col1") &"," & Cursor1.GetString("col2") &" " & Cursor1.GetString("col3") &")",3)

to
B4X:
ExecuteRemoteQuery("INSERT INTO department  VALUES ("& "'"&Cursor1.GetString("col1")&"'" &","&Cursor1.GetInt("col2")&", "& "'"&Cursor1.GetInt("col3")&"'" &")",3)

works:

but there are two records in database only one gets written to the remote server.

my logs show:

B4X:
Response from server: <br />
<b>Warning</b>:  mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\webservice\web.php</b> on line <b>22</b><br />
 
Last edited:
Top