Android Questionandroid.database.sqlite.SQLiteException: no such table: field1 (code 1 SQLITE_ERROR[1]): , while compiling: INSERT INTO field1 VALUES (?)
Hi everyone, I have an application designed to work with sqlite databases, I loaded an existing database from another application and as soon as I create an insertion of data on an edittext and store it in the database I receive an error as if it cannot find the field1 table , I point out that this database works in another application, where am I wrong?
I attach the offending code
btnsalvacucinaon:
Private Sub btnsalvacucinaon_Click
If txtcucinaon .Text="" Then
mp1.Load(File.DirAssets,"alert.wav")
mp1.Play
MsgboxAsync("Devi prima inserire l'indirizzo ip prima di salvare","AVVISO !!")
Else
dbsql1.ExecNonQuery2("INSERT INTO field1 VALUES (?)", Array As String(txtcucinaon.Text))
txtcucinaon.Text= (txtcucinaon.Text)
dbcursor1.Close
mp1.Load(File.DirAssets,"cash.wav")
mp1.Play
btnsalvacucinaon.Text="Elimina"
MsgboxAsync("Indirizzo IP aggiunto premuto qualche secondo il pulsante elimina se vuoi eliminarlo","ESEGUITO")
End If
End Sub
Sub Activity_Create(FirstTime As Boolean)
mp1.Initialize
Activity.LoadLayout("Layout")
If File.Exists(File.DirInternal, "comande.db") = False Then ' se non trova il database allora lo copia usando il rigo di sotto altrimenti non fa nulla.
File.Copy(File.DirAssets, "comande.db", File.DirInternal, "comande.db")
Log ("dbsql copio File")
End If
If FirstTime Then
dbsql1.Initialize(File.DirInternal, "comande.db", True) ' inizializza il database
End If
End Sub
But, what is the purpose of your database.
I have seen that you have 55 tables called field1 to field55.
And each table has one column called dataxx, where xx is the number of the field.
This database structure surprises me.
initially I created this database for order management for restaurants, in fact it works very well on the program while on this new program it doesn't, I called the tables field1 up to field 55 while the fields were called data1 up to data55, now in the new app this database is not working
I prefer to disable (or hide) the button for saving "in the" TextChanged event (actually from this event I call a Sub in which I enable/disable some Views).