Examples: ListFields method

The following agent displays the names of all the fields in the STUDENTS table of the ADTB data source:

Uselsx "*LSXODBC"
Sub Initialize
  Dim con As New ODBCConnection
  Dim msg As String
  If Not con.ConnectTo("ATDB") Then
    Messagebox "Cannot connect to ATDB"
    Exit Sub
  End If
  fields = con.ListFields("STUDENTS")
  msg = "STUDENTS contains the following fields:" & Chr(10)
  For n% = Lbound(fields) To Ubound(fields)
    msg = msg & Chr(10) & fields(n%)
  Next
  Messagebox msg,, "Fields for ATDB"
  con.Disconnect
End Sub