PreviousOLE DB Provider Guide ( revision 1) Next

Searching for Records

Show this topic in Library frames

The method you should use to search for records is dependent upon the configuration of your recordset. Pervasive supports the Index property and the Seek method for dynamic recordsets.

Although the functionality for the Sort and Find methods (which work only with static client-side cursors) is present in the Pervasive OLE DB provider, they are not currently supported and Pervasive advises against using them. Index and Seek are more robust and utilize the Pervasive engine directly for all searching and sorting, which results in a performance boost over using the client-side layer.


Note
In order to use the Seek method, you must specify adCmdTableDirect when opening the Recordset.

The Seek method requires a variant array containing the values to search for. An index consists of one or more columns and the array contains a value to compare against each corresponding column. Thus, if you have a segmented index, you would need to declare the variant array with a number of elements equal to the number of segments in the current index.

rs.Open "Person", "Provider=PervasiveOLEDB;Data 
Source=Demodata", adOpenDynamic, adLockBatchOptimistic, 
adCmdTableDirect 
Dim VariantArray (1) as Variant 
VariantArray(0) = "CA" 
VariantArray(1) = "Sacramento" 
rs.Index = "State_City" 
rs.Seek VariantArray adSeekFirstEQ 
rs.Close 

Chapter contents
Publication contents

Prev topic: Navigating Through and Manipulating Data
Next topic: Selecting Deferred-Update or Immediate-Update