Examples: NumColumns method

This agent executes an SQL query and displays the number of columns in the result set. See FieldName for another example.

Uselsx "*LSXODBC"
Sub Initialize
  Dim con As New ODBCConnection
  Dim qry As New ODBCQuery
  Dim result As New ODBCResultSet
  Set qry.Connection = con
  Set result.Query = qry
  con.ConnectTo("ATDB")
  qry.SQL = "SELECT * FROM STUDENTS"
  result.Execute
  Messagebox result.NumColumns,,  _
  "Number of columns in result set"
  result.Close(DB_CLOSE)
  con.Disconnect
End Sub