3 |
The LA Fox Developer Newsletter
March 2000
ADO
Jumpstart
(Con’t from page 1)
Filter property—The string that represents the current filter
expression. This property is like the SET FILTER statement in
Visual FoxPro. Unlike the Find method, multiple expressions
linked with AND or OR operators are allowed. This property is
only applicable to client-side recordsets.
Sort property—A comma-delimited set of fields that specifies
how the rows in an ADO recordset are sorted. This property is
only applicable to client-side recordsets.
State property—Specifies the state of an ADO recordset. Valid
State properties are closed, open, connecting, executing, or
fetching.
Status property—Specifies the editing status of the current
record. Valid Status properties include unmodified, modified,
new, and deleted. This property can be any one of the values
contained in RecordStatusEnum.
MarshalOptions property—Specifies how records are returned
(marshaled) to the server. Either all or only modified records
can
be returned. This property is only applicable to client-side
disconnected recordsets
MaxRecords property—Specifies the total number of records to
fetch from a data source.
RecordCount property—Specifies the number of records in a
recordset. This property is like the Recc(
)
function in Visual
FoxPro.
Source property—Specifies the command or SQL statement
that provides data for the recordset.
(Note: The type and location of a cursor as well as the OLE DB
provider you select will affect the recordset properties that are
available.)
Use the following table as a guide to help you make the right
recordset type and location decision:
Only client-side recordsets can be sorted and filtered. If the
CursorLocation property of ForwardOnly, KeySet, and Dynamic
recordset types is set to adUseClient, making them client-side
cursors, the CursorType property is automatically coerced to
the Static Cursor type.
(Note: This is the behavior of the OLE DB Provider for SQL
Server. The OLE DB Provider for ODBC supports only
ForwardOnly and Static recordsets, regardless of where the
recordset resides.)
As with properties, method availability can also vary:
Table 2. Available Methods
The following list describes some of the common methods you
will use in the ADO Recordset object:
MoveFirst, MovePrevious, MoveNext, MoveLast, and Move
methods—Navigational methods that work as their respective
names imply. The Move method accepts
two
arguments, the
number of records to move and the position from which to begin
the move. The Move method is similar to the Go statement in
Visual FoxPro. MoveFirst and MoveLast work like Go Top and
Go Bottom, respectively. Finally, MovePrevious and MoveNext
work like Skip 1 and Skip -1, respectively.
Find method—Accepts a criterion string as an argument and
searches the recordset for a match. If a match is not found,
depending on the search direction, either the BOF or EOF
property will evaluate to true (.T.). This method works much the
same way as the Seek and Locate statements in Visual
FoxPro. Unlike the Filter property and the Seek and Locate
statements in Visual FoxPro, the ADO Recordset object does
not allow multiple search values joined by the And or the Or
operator. Using anything other than a single search value will
result in an error.
Open method—Opens an existing ADO Recordset object. This
method accepts several arguments and is discussed in detail
later in this section.
(Con’t,
page 4)
Table 1. Properties
Page 3
|
3 |