Difference between revisions of "Database.Tables"

From Xojo Documentation

(Sample Code)
(Notes)
 
Line 12: Line 12:
  
 
== Notes ==
 
== Notes ==
 +
A [[DatabaseException]] will be raised if an error occurs.
 +
 
Tables returns a [[RowSet]] with one field: TableName As [[String]].
 
Tables returns a [[RowSet]] with one field: TableName As [[String]].
  

Latest revision as of 16:09, 12 January 2022

Method

Database.Tables() As RowSet

New in 2019r2

Supported for all project types and targets.

Returns a RowSet with a list of all tables in the database.

Notes

A DatabaseException will be raised if an error occurs.

Tables returns a RowSet with one field: TableName As String.

Sample Code

The following code gets and displays the table names for the connected database:

// App.db is a connected database
Var tables As RowSet
tables = App.db.Tables

Try
For Each row As DatabaseRow In tables
MessageBox(row.ColumnAt(0).StringValue)
Next
tables.Close
Catch error As NilObjectException
MessageBox("This database has no tables.")
End Try

See Also

Database.TableColumns method