update query neither updating or erroring?

MichaelTJ

Member
Licensed User
Longtime User
as a newbie i am probably missing something obvious but....
i click on item on a scroll list, pass the record id and populate the EditText fields of a screen with the data from that single record that i clicked on.... then i change one of the EditText fields where i change the value, then i click on a button that performs an update query.... my feeling is that the change i made should now be in that sql table/record field.... WHAT am i missing?

Sub Button2_Click
'update the record being viewed

SQL1.Initialize(File.DirDefaultExternal, "DTrack.db", True)

Cursor1.IsInitialized
Cursor1.Position = 0

Dim tval1 As Int
tval1 = recordID
'checking via debug that recordid is correct and it is

Dim NEWVAL As String
NEWVAL = EditText2.TEXT
EditText2.Initialize(EditText2)
'checking via debug that values are correct, they are
'updating with NEWVAL rather than EditText2 does not solve the problem

Cursor1 = SQL1.ExecQuery("UPDATE CPF SET col2='EditText2.TEXT', col3='EditText3.TEXT' WHERE ID= 'recordid'")

Msgbox(" ", " ")

End Sub

as i say, no errors show but the new value for "col2" as supplied by EditText2.TEXT is not present when i reacquire the scrollview listing
 

stevel05

Expert
Licensed User
Longtime User
You need to use SQL1.ExecNoNQuery2 and check the syntax.

Try:

B4X:
SQL1.ExecNonQuery2("UPDATE CPF SET col2= ?, col3=? WHERE ID= ?",Array As String(EditText2.TEXT,EditText3.TEXT,recordid))
 
Last edited:
Upvote 0
Top