Recordsets are read
only and are able to open only SELECT statements.
Open |
variable = object.Open(connectString [, type[, options]])VARIANT_BOOL Open(
[in] BSTR bstrSQL,
[in, optional] VARIANT varType,
[in, optional] VARIANT varOptions);
|
|
Executes the query using
the connection established by the creator Connection object and prepares the recordset for
cycling. connectString can be any valid SQL SELECT
statement string.
type is optional but can be used to specify the type of the
recordset. Because the recordsets in this version of NOSC are read only it will be rarely
needed and useful to specify the recordset type. Allowed types are:
dbrOpenTypeDynaset = 0
dbrOpenTypeSnapshot = 1
dbrOpenTypeForwardOnly = 2 default - used if omitted
dbrOpenTypeDynamic = 3
options this parameter can be treated as "reserved"
for the future extensions. It accepts combinations of flags listed below but because of
the fact that the recordset is read only they will not have effect or will cause errors.
dbrOpenOptReadOnly = 0x0004 default - used if omitted
dbrOpenOptAppendOnly = 0x0008
dbrOpenOptSkipDeleted = 0x0010
dbrOpenOptNoDirtyCheck = 0x0020
dbrOpenOptUseBookmarks = 0x0100
dbrOpenOptMultiRowFetch = 0x0200
dbrOpenOptAllocMultiRowBuffers = 0x0400
dbrOpenOptExtendedFetch = 0x0800
dbrOpenOptExecuteDirect = 0x2000
Method returns true/false on success/error. Check errCode and errDescription
properties for details |
Close |
object.Close()void Close();
|
|
Closes the the recordset. |
Move |
object.Move(rows[,moveType])void Move(
[in] long lRows,
[in, optional] VARIANT varType);
|
|
Moves the corrent record. rows
- number specifies how many rows to move. Direction and resulting position depends on
the moveType constant.
moveType specifies the moveType see the constants below:
dbrFetchNext = 1
Moves to the next record. rows value is ignored
dbrFetchFirst = 2
Moves to the first record. rows value is ignored
dbrFetchLast = 3
Moves to the last record. rows value is ignored
dbrFetchPrior = 4
Moves to the previous record. rows value is ignored
dbrFetchAbsolute = 5
rows specifies absolute position relative to the first record
dbrFetchRelative = 6 (default)
rows specifies relative position relative to the current record
See also BOF and EOF properties. |
MoveNext
MovePrev
MoveFirst
MoveLast |
object.MoveNext()
object.MovePrev()
object.MoveFirst()
object.MoveLast()
void MoveNext();
void MovePrev();
void MoveFirst();
void MoveLast();
|
|
Methods implementing most
often used calls that can be made to the Move method. MoveNext
- Moves to the next record
MovePrev - Moves to the previous record
MoveFirst - Moves to the first record
MoveLast - Moves to the last record |
Requery |
object.Requery()void Requery();
|
|
Refreshes/re-executes the
query used to open the recordset. |
connected |
variable = object.connected[propget] VARIANT_BOOL connected();
|
|
Read only property
returning boolean result indicating if the Recordset object is connected to a data source. |
errCode |
variable = object.errCode[propget] long errCode();
|
|
Read only property.
Returns error code long value. The property returns meaningful value only after failure
reported by some method such as Open. Error codes depend on the DB provider and are non
zero. Can be inspected after DB exception too. |
errDescription |
variable = object.errDescription[propget] BSTR errDescription();
|
|
Read only property. Returns textual error description. In most cases
it is generated by the provider or the ODBC itself. The property returns meaningful value
only after failure reported by some method such as Open. Error codes depend on the DB
provider and are non zero. Can be inspected after DB exception too. |
BOF |
variable = object.BOF[propget] VARIANT_BOOL BOF();
|
|
Indicates if the current recordset position is before the first
record. |
EOF |
variable = object.EOF[propget] VARIANT_BOOL EOF();
|
|
Indicates if the current recordset position is after the last record.
When looping through the records the program should check if the EOF is not true. Item
property can be used only over a valid record and will raise exception if the current
position is not a valid record - that includes situations when one of the EOF or BOF
properties is true. |
fieldCount |
variable = object.fieldCountlong fieldCount();
|
|
Returns the count of the columns of the result of the query. Can be
used to implement flexible recordset usage without prior knowledge about the query passed
to the Open method and table definition. |
Item |
variable = object.Item(field_name_or_index)
variable = object(field_name_or_index)[propget] VARIANT Item([in] VARIANT varIndex);
|
|
Default, Indexed read only
property. Returns the value of the column specified by the field_name_or_index
in the current record. field_name_or_index - Can be a string
containing the field name or a number specifying a 0-based index of the column (see also
fieldCount property above). Can be read only once for a given record. |
recordCount |
variable = object.recordCount[propget] long recordCount();
|
|
Read only property returning the total count of the returned records
by the query passed to the Open method. |