Examples: FieldSize method

This agent executes an SQL query and displays the column number, name, and size of each field in the result set.

Uselsx "*LSXODBC"
Sub Initialize
  Dim con As New ODBCConnection
  Dim qry As New ODBCQuery
  Dim result As New ODBCResultSet
  Dim msg As String
  Set qry.Connection = con
  Set result.Query = qry
  con.ConnectTo("ATDB")
  qry.SQL = "SELECT * FROM STUDENTS"
  result.Execute
  msg = "Fields in STUDENTS table:" & Chr(10)
  For i = 1 To result.NumColumns
    msg = msg & Chr(10) & i & " " & result.FieldName(i) _
    & " " & result.FieldSize(i)
  Next
  Messagebox msg,, "Field names and sizes"
  result.Close(DB_CLOSE)
  con.Disconnect
End Sub