Page 1 of 1

gett all tables list in SQLite?

Posted: Thu Jul 17, 2003 5:21 am
by ricardo
Hi,

Im pretty new into SQLite, and im trying to display a list with all the tbles in certain database.

Ive tried:

Code: Select all

Result = SQLiteExec("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name")

Result = SQLiteExec("SELECT name FROM sqlite_master WHERE type IN ('table', 'index')")

Result = SQLiteExec("SELECT name FROM sqlite_master")
No one give me 'error', but cannot get the table names

Rows = SQLiteRows()
Cols = SQLiteCols()

Gives me 0 as result. :cry:

Thanks in advance for any assitance or tip

Posted: Thu Jul 17, 2003 4:36 pm
by ebs
Ricardo,

SQLiteExec() is used only to execute a command which does not return any data. When you want to get data as a result of a query, you must use SQLiteGetTable(). When you are finished with the table data, use SQLiteRemoveData() to free the table.

Code: Select all

SQLiteGetTable("Select Name FROM sqlite_master WHERE type='table' ORDER BY Name")
For Row.l = 1 To SQLiteRows()
  Debug SQLiteData(Row,0)
Next
SQLiteRemoveData()
Regards,
Eric

Posted: Thu Jul 17, 2003 6:44 pm
by ricardo
@ebs

Thanks!!!

I really appreciate your help :D