Android Question UPDATE database

Basco

Member
Licensed User
Longtime User
Hi,
I'm trying to update my database. I am using this statement but my application crashes when performing this statement.
I don't really know how to use UPDATE SQLite statement.
Here is my sub :

Sub Button1f_Click
dbsql.ExecNonQuery2("UPDATE Plateforme ('AnneeAchat','PrixAchat','Commentaire') VALUES (?,?,?) WHERE Modele = ? ", Array As String(EditText1f.Text, EditText2f.Text, EditText3f.Text, Spinner1f.SelectedItem))
dbcursor.close
Msgbox("modifications enregistrées sur " & Spinner1f.SelectedItem,"")​
End Sub

What could be wrong ?

Thank you for your time !
 

Mahares

Expert
Licensed User
Longtime User
Here is the code you need if you are not using DBUtils that Giga is referring to:
B4X:
dbsql.ExecNonQuery2("UPDATE Plateforme SET AnneeAchat =?,PrixAchat =?, " _
& "Commentaire =? WHERE Modele = ? ", _
Array As Object(EditText1f.Text, EditText2f.Text, EditText3f.Text, Spinner1f.SelectedItem))
Msgbox("modifications enregistrées sur " & Spinner1f.SelectedItem,"")
Bonne Chance
 
Upvote 0

Basco

Member
Licensed User
Longtime User
Thanks to all of you for your answers.
Your code works great Mahares ! (I had no doubt !)
I'll improve my skills with yours advices, thanks
 
Last edited:
Upvote 0
Top