Examples: LocateRow method

This agent locates all rows in a result set with "Cambridge" in field 5 and "MA" in field 6.

Uselsx "*LSXODBC"
Sub Initialize
  Dim con As New ODBCConnection
  Dim qry As New ODBCQuery
  Dim result As New ODBCResultSet
  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 = "Students from Cambridge MA:" & Chr(10)
  result.FirstRow
  Do While result.LocateRow(5, "Cambridge", 6, "MA")
    msg = msg &Chr(10)
    For i = 1 To result.NumColumns
      msg = msg & result.GetValue(i) & "  "
    Next
    If result.IsEndOfData Then Exit Do
    result.NextRow
  Loop
  Messagebox msg
  result.Close(DB_CLOSE)
  con.Disconnect
End Sub