Examples: UseRowID property

This example shows you how to enable "select by row ID" mode and then access rows by their IDs, for example, in an Informix database. Remember to place the qry.UseRowID = True statement before the qry.SQL = [SQL statement] in your script, as shown below.

Uselsx "*LSXODBC"
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
End Sub
Sub Click(Source As Button)
  Dim firstName As String
  Dim lastName As String
  Dim msg As String
  con.ConnectTo("ATDB")
  qry.UseRowID = True
  qry.SQL = "SELECT * FROM STUDENTS"
  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"
  result.Close(DB_CLOSE)
  con.Disconnect
End Sub