Hello,
I'm recording some app's variables as key/values pairs in a table on the fly so I don't know in advance if a variable is present. I try to use Cursor.GetColumnName but I ran into this problem when i=3 (see my code).
I don't know how to deal with that. Any help?
Edit: found that the index of GetColumnName is related to the number of columns in the table.
Serge
I'm recording some app's variables as key/values pairs in a table on the fly so I don't know in advance if a variable is present. I try to use Cursor.GetColumnName but I ran into this problem when i=3 (see my code).
B4X:
csr = Starter.db.ExecQuery("SELECT * FROM misc")
For i = 0 To csr.RowCount-1 ' <-- RowCount = 4
If csr.GetColumnName(i) = "autoplay" Then ' <- error : ArrayIndexOutOfBoundsException: length=3; index=3
AutoPlay.Checked = (csr.GetString("autoplay") = "true")
csr.Close
Exit
End If
Next
I don't know how to deal with that. Any help?
Edit: found that the index of GetColumnName is related to the number of columns in the table.
Serge
Last edited: