Hi All,
I am having problems with a B4A app that inserts records into a MySQL database. I can read the database so the connection is working correctly but when I try to write to the database I get errors with the Insert format and I have no idea why.
I am using MSMysql in B4A - v1.09. The same INSERT INTO line works in B4J
The logged date string is: DBDate = 2021-07-22 18:00:10
The MySQL field is DATETIME
Any help gratefully accepted.
Thanks
I am having problems with a B4A app that inserts records into a MySQL database. I can read the database so the connection is working correctly but when I try to write to the database I get errors with the Insert format and I have no idea why.
B4X:
Dim dbCount As Double = txtCount.text
Dim dbLocation As String = txtLocation.text
Dim dbDate As String = Utils.DateTimeToMysql(DateTime.Now) 'converts DateTime.Now to "YYYY-MM-DD HH:MM:SS" mySQL format
Log("DBDate = "&dbDate)
db.ExecuteASync("INSERT INTO stocktake SET stockID="&stockID&", partno="&stkPartNo&", count="&dbCount&", location="&dbLocation&", countdate="&dbDate&";","")
I am using MSMysql in B4A - v1.09. The same INSERT INTO line works in B4J
The logged date string is: DBDate = 2021-07-22 18:00:10
The MySQL field is DATETIME
SqlException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '18:00:10' at line 1
Any help gratefully accepted.
Thanks