From Xojo Documentation

Revision as of 17:11, 20 January 2020 by PLefebvre (talk | contribs) (Sample Code)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Database.TableIndexes(TableName as String) As RowSet

New in 2019r2

Supported for all project types and targets.

Returns a RowSet containing the list of indexes for the passed TableName. Returns Nil if the table has no indexes or the database source does not support indexes.


The RowSet returns one row for each index on the table and it has one field: IndexName As String.

Sample Code

This code displays the indexes for the "Invoices" table (if it exists) in the specified SQLite database:

Var dbFile As FolderItem
dbFile = FolderItem.ShowOpenFileDialog("")

If dbFile <> Nil Then
Var db As New SQLiteDatabase
Var indexRS As RowSet
indexRS = db.TableIndexes("Invoices") // A table with indexes in the SQLite DB
For Each row As DatabaseRow In indexRS
MessageBox("Index: " + row.ColumnAt(0).StringValue)
Catch error As NilObjectException
MessageBox("This database has no indexes.")
Catch error As DatabaseException
MessageBox("Could not connect to database. Error: " + error.Message)
End Try
End If