LOTUS CONNECTORS


Examples: NumRows method
This agent uses a For loop, NumRows, and CurrentRow to access all rows in a result set. The LastRow that precedes the loop is essential; otherwise, NumRows is not correct.

Uselsx "*LSXODBC"

Sub Initialize
 Dim con As New ODBCConnection
 Dim qry As New ODBCQuery
 Dim result As New ODBCResultSet
 Dim firstName As String
 Dim lastName As String
 Dim msg As String
 Set qry.Connection = con
 Set result.Query = qry
 con.ConnectTo("ATDB")
 qry.SQL = "SELECT * FROM STUDENTS ORDER BY LASTNAME"
 result.Execute
 result.LastRow
 msg = "Student names:" & Chr(10)
 For  i = 1 To result.NumRows
   result.CurrentRow = i
   firstName = result.GetValue("FIRSTNAME", firstName)
   lastName = result.GetValue("LASTNAME", lastName)
   msg = msg & Chr(10) & firstName & " " & lastName
 Next
 Messagebox msg,, "Student Names"
 result.Close(DB_CLOSE)
 con.Disconnect
End Sub

See Also