I have created a database that is loaded into my app. One table is named "highscores" where I want to store the "highscore" and "time" As Int.
To read the cell is like this:
But how is the code to update a cell? The only code I could find was this:
But I was not able to change the code so that it worked for me.
I tried this:
But this wasn't working.
I am looking for something like this, if it is possible:
I know that this code is totaly wrong, but I think it explane waht I want.
Anyone an idea how to updabe the two cells in an easy way?
To read the cell is like this:
B4X:
Cursor1 = Sql1.ExecQuery("SELECT * FROM highscores")
Cursor1.Position = level
oldscore = Cursor1.GetInt("score")
oldtime = Cursor1.GetInt("time")
Cursor1.Close
But how is the code to update a cell? The only code I could find was this:
B4X:
Sub UpdateEntry
Dim Query As String
Query = "UPDATE persons Set FirstName = ?, LastName = ?, City = ? _
WHERE ID = " & IDList.Get(CurrentIndex)
SQL1.ExecNonQuery2(Query, Array As String(edtFirstName.Text, _
edtLastName.Text, edtCity.Text))
ToastMessageShow("Entry updated", False)
End Sub
But I was not able to change the code so that it worked for me.
I tried this:
B4X:
Dim Query As String
Query = "UPDATE highscores SET highscore = ?, time = ? WHERE ID = " & level
Sql1.ExecNonQuery2(Query, Array As String(newhighscore, newbesttime))
I am looking for something like this, if it is possible:
B4X:
Cursor1 = Sql1.ExecQuery("UPDATE * FROM highscores")
Cursor1.Position = level
' Cursor1.Update("score") = newhighscore
' Cursor1.Update("time") = newbesttime
Cursor1.Close
I know that this code is totaly wrong, but I think it explane waht I want.
Anyone an idea how to updabe the two cells in an easy way?