LOTUS CONNECTORS


Examples: IsBeginOfData method
This agent accesses all rows of a result set starting from the last row. You must explicitly set LastRow and process it outside the loop. In the loop, each PrevRow gets the previous row in the data set. IsBeginOfData detects that the first row was processed.

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

See Also