This example creates a new snapshot-type Recordset object and opens it, appending it to the Recordsets collection in the default database. It then finds a record and prints it.
FUNCTION Start
LOCAL dbeng AS DaoDBEngine
LOCAL db AS DaoDatabase
LOCAL rstTitles AS DaoRecordset
Set color TO w+/b
cls
// Open the database.
dbEng := DaoDbEngine{}
db := dbEng:OpenDatabase("\vo2jet\Northwind.mdb",NIL,NIL,NIL)
// Open a recordset on Titles table.
rstTitles := db:OpenRecordset("Titles", dbOpenSnapshot,NIL,NIL)
IF rstTitles:RecordCount > 0
rstTitles:FindFirst("Title Like '*Computer*'") // Any title on computers
DO WHILE .not. rstTitles:NoMatch
? rstTitles:Fields:[Item,"Title"]:Value
rstTitles:FindNext("Title Like '*Computer*'")
ENDDO
?
? "And now in reversed order"
?
rstTitles:FindLast("Title Like '*Computer*'") // Any title on computers
DO WHILE .not. rstTitles:NoMatch
? rstTitles:Fields:[Item,"Title"]:Value
rstTitles:FindPrevious("Title Like '*Computer*'")
ENDDO
ELSE
? "No such title"
ENDIF
db:Close()
wait