ODBCDatabase.PrimaryKeys
From Xojo Documentation
Method
Returns a RowSet containing the column names that make up the primary key for a table.
References
Example
Displays the primary keys for a table:
Var db As New ODBCDatabase
db.DataSource = "TeamExample"
Try
db.Connect
Var rs As RowSet
rs = db.PrimaryKeys("Team")
If rs <> Nil Then
While Not rs.AfterLastRow
ListBox1.AddRow(rs.ColumnAt(1).StringValue)
rs.MoveToNextRow
Wend
rs.Close
End If
Catch error As DatabaseException
MessageBox("Error: " + error.Message)
End Try
db.DataSource = "TeamExample"
Try
db.Connect
Var rs As RowSet
rs = db.PrimaryKeys("Team")
If rs <> Nil Then
While Not rs.AfterLastRow
ListBox1.AddRow(rs.ColumnAt(1).StringValue)
rs.MoveToNextRow
Wend
rs.Close
End If
Catch error As DatabaseException
MessageBox("Error: " + error.Message)
End Try