LOTUS CONNECTORS


Examples: FirstRow method
This agent accesses all rows of a result set twice starting from the first row. The first time you do not explicitly set FirstRow -- the first NextRow following an Execute implicitly sets FirstRow. The second time, you must explicitly set FirstRow and process the first row outside the loop that follows.

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
 msg = "Student names:" & Chr(10)
 Do
   result.NextRow
   firstName = result.GetValue("FIRSTNAME", firstName)
   lastName = result.GetValue("LASTNAME", lastName)
   msg = msg & Chr(10) & firstName & " " & lastName
 Loop Until result.IsEndOfData
 Messagebox msg,, "Student Names"
 msg = "Student names:" & Chr(10)
 result.FirstRow
 firstName = result.GetValue("FIRSTNAME", firstName)
 lastName = result.GetValue("LASTNAME", lastName)
 msg = msg & Chr(10) & firstName & " " & lastName
 Do
   result.NextRow
   firstName = result.GetValue("FIRSTNAME", firstName)
   lastName = result.GetValue("LASTNAME", lastName)
   msg = msg & Chr(10) & firstName & " " & lastName
 Loop Until result.IsEndOfData
 Messagebox msg,, "Student Names"
 result.Close(DB_CLOSE)
 con.Disconnect
End Sub

See Also