SQLite select never misses

Why “rs” it’s never nil? even if the table database is empty
It returns a recordset with all fields nil

Dim sql As String
Dim rs As RecordSet

sql = "SELECT * from results WHERE aTipus = " + kind + “;”
rs = db.SQLSelect(sql)

return rs

SQLSelect will return a nil RecordSet if there’s a SQL error.

More information from Bob Keeney: https://bkeeneybriefs.com/2019/01/nil-recordset/

because it should never be nil… UNLESS it is a malformed query to begin with.

If the table is empty, or the criteria return no results, it is still valid… and RECORDCOUNT will be zero.

it could be valid query and still return an error (field not found etc)… it will be nil if it is syntacially incorrect

But, the exemple in the language reference for RecordSet use
If data <> Nil Then

Why did you delete your original question?

[quote=430671:@Enric Herrera]But, the exemple in the language reference for RecordSet use
If data <> Nil Then[/quote]
This checks that the object is not nil prior to using it. This prevents an unexpected NilObjectException.

Deleted by mistake, trying to edit