1. Alexis Colon Lugo
  2. Valentina Server
  3. 月, 12月 30 2019, 07:55 PM
  4.  メールで購読
Send data from iOS On XOJO
This code works but it send only one record then have a error but k'now the error and the app close.
Any idea what is the problem
Thanks


Var sqlLocation As Text = App.mSessionURL + "/sql_fast"
Var v1,v2,v3,v4,v5,pic_as_text,er As Text
Var Rs As iOSSQLiteRecordSet
Var SqlStr As Text

SqlStr="Select * From AsambleaSocios Order BY numsocio"

Try
Rs=App.DBConn.SQLSelect(SqlStr)
Catch e As iOSSQLiteException
//ErrorLabel.Text = e.Reason
er= e.Reason
End Try

If Rs.RecordCount > 0 Then

Do

v1=Rs.Field("nombre";).TextValue
v2=Rs.Field("numsocio";).TextValue
v3=Rs.Field("fecha";).TextValue
v4=Rs.Field("hora";).TextValue
pic_as_text=Rs.Field("firma";).TextValue
v5=Rs.Field("distrito";).TextValue


Var sql As text = "INSERT INTO AsambleaSocios (nombre,numsocio,fecha,hora,firma,sync,distrito) VALUES ('"+ v1 + "','"+ v2 + "', '" + v3 + "', '" + v4 + "', '" + pic_as_text + "','Y','" +v5 + "')"

mSQLSocket.Start( App.mHost, App.mSessionID, sqlLocation, "SQLite", "ipadcrnew.db",sql)

Loop Until Rs.EOF=True

End If
コメント
There are no comments made yet.
Alexis Colon Lugo 承諾済みの回答
the problem is in the loop i call this mSQLSocket.Start( App.mHost, App.mSessionID, sqlLocation, "SQLite", "ipadcrnew.db",sql) but work if i exit the loop it save one record so is no way to call PageReceived and then send the next record.
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
Connection to the server - no need to close.
Try to debug step by step - at which point it crashes? Before making the REST call or after?
コメント
There are no comments made yet.
Alexis Colon Lugo 承諾済みの回答
same problem using
sql += "INSERT INTO AsambleaSocios (nombre,numsocio,fecha,hora,firma,sync,distrito) VALUES ('"+ v1 + "','"+ v2 + "', '" + v3 + "', '" + v4 + "', '" + pic_as_text + "','Y','" +v5 + "');"
crash with no error
コメント
There are no comments made yet.
Alexis Colon Lugo 承諾済みの回答
ok
But i have to run any other procedure like close and then reopen connection ?
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
No need to execute each line separately.

Var sql As text = "INSERT INTO AsambleaSocios (nombre,numsocio,fecha,hora,firma,sync,distrito) VALUES ('"+ v1 + "','"+ v2 + "', '" + v3 + "', '" + v4 + "', '" + pic_as_text + "','Y','" +v5 + "')"

Declare sql variable out of the loop at the top and add values at each iteration:
sql += "INSERT INTO AsambleaSocios (nombre,numsocio,fecha,hora,firma,sync,distrito) VALUES ('"+ v1 + "','"+ v2 + "', '" + v3 + "', '" + v4 + "', '" + pic_as_text + "','Y','" +v5 + "');"

Now make sure you have all records in the sql variable - view in the debugger.

Then you can send them. If the records become too much you just split it into a few parts.
コメント
There are no comments made yet.
Alexis Colon Lugo 承諾済みの回答
I need to sync the data with my raspberry pi server of Rest ?
can you explain more details on how to do it.

If you have other way to do this then send my example of code.

thanks
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
Hello,

Without using REST - does it crash?
What if you try to gather values for multiple records in sql variable without sending to REST - does it have what you need? Then you can send it at once, it will be much faster than separate request.
コメント
There are no comments made yet.
Alexis Colon Lugo 承諾済みの回答
this is the only record in the raspberry pi on valentine server with sqlite
添付ファイル
コメント
There are no comments made yet.
Alexis Colon Lugo 承諾済みの回答
NO same error and i add the Rs.MoveNext
コメント
There are no comments made yet.
  • ページ :
  • 1
  • 2


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories