LOTUS CONNECTORS


Examples: MaxRows property
This agent limits the result set to what the user specifies, defaulting to the complete result set.

Uselsx "*LSXODBC"
%INCLUDE "lsconst.lss"

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
 If Messagebox("", MB_YESNO, _
 "Do you want the whole result set?") = IDYES Then
   maxRows = 0
 Else
   maxRows = Inputbox("How many rows?", _
   "MaxRows", "50")
   If maxRows = "" Then maxRows = 0
 End If
 result.MaxRows = maxRows
 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"
 con.Disconnect
End Sub

See Also