LOTUS CONNECTOR


例:MaxRows プロパティ
次のエージェントは、結果セットをユーザーが指定したものに制限します。デフォルト値は完全な結果セットです。

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

関連項目