LOTUS CONNECTORS


Examples: SetParameter method
This example shows a form action (the Click sub) that sets the parameters for the SQL query in the Postopen sub. Although the query in the Postopen sub contains exactly two string parameters, the action works for a variable number of string parameters. Note that the Click sub places single quotes around the value of the string parameter.

Uselsx "*LSXODBC"

Dim con As ODBCConnection
Dim qry As ODBCQuery
Dim result As ODBCResultSet

Sub Postopen(Source As Notesuidocument)
 Set con = New ODBCConnection
 Set qry = New ODBCQuery
 Set result = New ODBCResultSet
 Set qry.Connection = con
 Set result.Query = qry
 con.ConnectTo("ATDB")
 qry.SQL = "SELECT * FROM STUDENTS WHERE " & _
 "LASTNAME = ?lastName? AND FIRSTNAME = ?firstName?"
End Sub

Sub Click(Source As Button)
 Dim inputParameter As String
 For i = 1 To result.NumParameters
   inputParameter = Inputbox$(result.GetParameterName(i), _
   "Parameter " & i)
   Call result.SetParameter(i, "'" &  _
   inputParameter & "'")
 Next
End Sub

Sub Queryclose(Source As Notesuidocument, Continue As Variant)
 result.Close(DB_CLOSE)
 con.Disconnect
End Sub

See Also