Helloy B4J folks,
i am trying to send Datas to my webserver and put them there into a SQL database named : SensorDatas.
Everything works but when my Handler trys to put the datas into the SQL database i receive this Exception.
I think that i understand what it means, but i don´t know how i can solve this issue.
Thats my Handler Code:
And here the Subroutine InsertValues:
The issue happend at the execute of the query.
I have no experience with SQL and Server, cause of that please be patient with me
And many thanks for youre help.
i am trying to send Datas to my webserver and put them there into a SQL database named : SensorDatas.
Everything works but when my Handler trys to put the datas into the SQL database i receive this Exception.
B4X:
java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (near "17": syntax error)
I think that i understand what it means, but i don´t know how i can solve this issue.
Thats my Handler Code:
B4X:
Sub Handle(req As ServletRequest, resp As ServletResponse)
Dim data As sensorDatas = Main.ReadObject(req.InputStream)
Dim m As Map
m.Initialize
m.Put("Datas",data.datas)
m.Put("Date", data.date )
DBUtils.InsertValues(Main.SQL1, "SDatas", m)
Log("Datas added succesfully.")
End Sub
And here the Subroutine InsertValues:
B4X:
Public Sub InsertValues (SQL As SQL, TableName As String, Values As Map)
Dim sb As StringBuilder
sb.Initialize
sb.Append("INSERT INTO " & TableName & "(" & Values.GetKeyAt(0) & ", " & Values.GetKeyAt(1) & _
") VALUES (" & Values.GetValueAt(0) & ", " & Values.GetValueAt(1) & ")")
Log(sb.ToString)
SQL.ExecNonQuery(sb.ToString)
End Sub
The issue happend at the execute of the query.
I have no experience with SQL and Server, cause of that please be patient with me
And many thanks for youre help.