SQLiteDataBase.TableSchema ?

I have just started using Xojo. I have a SQLite database with tables and I wish to choose the tables names and/or cycle through them using SQLiteDataBase.TableSchema as illustrated in the documentation (such as it is) and i get tables = Nil. Here’s the code

d2 = New OpenDialog
d2.PromptText = " Choose Database "
DBFile = d2.ShowModal
Dim db As SQLiteDatabase
db = New SQLiteDatabase
db.DatabaseFile = DBFile
Dim tables As RecordSet
tables = db.TableSchema

and tables is Nil

Seems excruciatingly simple… help!

SELECT tbl_name FROM SQLITE_MASTER where type=“table”

you can do the same for index using “where type=‘index’”

You have to Connect first. (I’ve also included some shorthand in the code below.)

Dim db As new SQLiteDatabase
db.DatabaseFile = DBFile
if not db.Connect() then
  // There was some problem
  return
end if
Dim tables As RecordSet = db.TableSchema

I figured there was some need to connect. Thanks very much for answering such elementary questions.

Everyone starts somewhere, and nobody knows everything.

Except for Norman, of course. :slight_smile: