I assumed that a record with those values certainly existed.
Yes, unless you are very sure about your data.
I modified @aeric's code to make sure I choose a parameter that does not exist, but it still did not crash. It still returns a null value. I think your problem is somewhere else. I do not want to beat a dead horse, but we have to:
B4X:
Sub RunStressTest
File.Delete(File.DirApp, "Data.db")
If File.Exists(File.DirApp, "Data.db") = False Then
DB.InitializeSQLite(File.DirApp, "Data.db", True)
Dim Query As String = "CREATE TABLE Test (id INTEGER)"
DB.ExecNonQuery(Query)
Dim Query As String = "INSERT INTO Test (id) VALUES (100)"
DB.ExecNonQuery(Query)
Else
DB.InitializeSQLite(File.DirApp, "Data.db", False)
End If
Dim Query As String = "SELECT id FROM Test WHERE id = ?"
Dim Result As Object
Result = DB.ExecQuerySingleResult2(Query, Array As Int(101))
Log(Result)
DB.Close
End Sub