After 'Aaa' and After 'N' the variables are empty. They are only number in textx areas, like the other variables (All the variables are strings). A reload of a listView shows me that the line inserted is not saved.
The initialization of the database made with DB Browser is done in the Starter Module:
B4X:
If File.Exists(File.DirDefaultExternal, "pev.db") = False Then
File.Copy(File.DirAssets, "pev.db", File.DirDefaultExternal, "pev.db")
End If
SQL1.Initialize(File.DirDefaultExternal, "pev.db", True)
So, it's a so tiny use that I'm not able to see where is the mistake.
Has someone an idea how to solve this ?
It doesn't work, BUT, if I transform ExecQuery2 by ExecNonQuery2, when I refresh the ListView, the line appears..
BUT, BUT, if I reload the app, the line is not present !!!
Good grief, I'm not really useful today. ExecNonQuery2 is the correct method, since ExecQuery is for SELECT statements. Should have tested it (and maybe paid closer attention to it).
Put a log statement where you copy the dB file from assets to dir external and see what happens every time you start your application
B4X:
If File.Exists(File.DirDefaultExternal, "pev.db") = False Then
File.Copy(File.DirAssets, "pev.db", File.DirDefaultExternal, "pev.db")
Log(“copying dB from assets”)
End If
SQL1.Initialize(File.DirDefaultExternal, "pev.db", True)
If it is copying it every time, you could have a permission issue
You can see that after the SQL1.ExecNonQuery(....) the code refreshes the listview (on the right). We can see the added city beloww (Aaa).
But when I restart the app, this line does not exists.