Purpose
This property can be used to read, update, or append a record in
the database. It provides a convenient and intuitive way to manipulate
records using keys as the primary form of access.
It
has the special ability to manipulate one of a series of records that
have the same key.
Syntax (Read/Write Property)
(Read)
Data
= object.DataArrayB(Key,
Instance)
(Write) object.DataArrayB(Key,
Instance) = Data
| Key
(String) |
|
This
is the key of the record you want to retrieve data from. |
| Instance
(String) |
|
This
is the instance of the record named with the specified key you
want to retrieve data from.
Key
and Instance
work together to specify a record. For example, if Instance
is 3, then the property reads the 4th (zero-based) record that
is named Key.
This
parameter is zero-based.
Negative
values are bound to zero (0).
|
| Data
(Byte Array) |
|
This
is the data that is retrieved from the specified record. |
| Key
(String) |
|
This
is the key of the record you want to assign data to. |
| Instance
(String) |
|
This
is the instance of the record named with the specified key you
want to append or assign data to.
Key
and Instance
work together to specify a record. For example, if Instance
is 3, then the property updates the 4th (zero-based) record that
is named Key.
This
parameter is zero-based.
Negative
values are bound to zero (0).
|
| Data
(Byte Array) |
|
This
is the data you want to assign to the specified record. |
Notes
(Read)
This property allows you to retrieve data from a specified record.
If
a record with the specified key/instance already exists: (1)
The data associated with the specified record is returned as a string.
(2) The ErrorNumber
property returns rtCDP_ErrNoError.
If
a record with the specified key/instance does not already exist: (1)
Function returns a zero-length string (""). (2) The ErrorNumber
property returns rtCDP_ErrRecordNotFound.
If
any errors occur, the function returns a zero-length string ("").
Notes
(Write)
This property allows you to update records and append records to
the database.
If
a record with the specified key/instance already exists: (1)
The data associated with the record is updated to contain the specified
data. (2) The ErrorNumber
property returns rtCDP_ErrNoError.
If
a record with the specified key/instance does not already exist: (1)
Then new records are added to the end of the database. As many records
are added as necessary until the specified instance exists. All the
new records are given the name specified in the Key
parameter. All of the new records except the specified one are given
a zero-length string for data. The specified record is given the data
specified in the Data
parameter. (2) The ErrorNumber
property returns rtCDP_ErrNoError.
If
any errors occur, no records are changed.
Error
Values (Read)
After reading this property, the property ErrorNumber
will report one of the following values:
rtCDP_ErrNoError
rtCDP_ErrKeyTooLong
rtCDP_ErrRecordNotFound
Error
Values (Write)
After writing this property, the property ErrorNumber
will report one of the following values:
rtCDP_ErrNoError
rtCDP_ErrKeyTooLong
rtCDP_ErrDataTooLong
rtCDP_ErrDatabaseFull
Example
Objective: Create a list of 100,000 random numbers between 1 and 10.
'Create
a database
Dim CDP As
rtCDP.rtCompactDataPak
Set CDP = New rtCDP.rtCompactDataPak
'Initiate
variables
Dim
RandomNumber(0) As
Byte
Dim
C As Long
'The
main loop
For
C = 0 To 100000
...RandomNumber(0)
= Int(10 * Rnd + 1)
...CDP.DataArrayB("",
C) = RandomNumber
Next C
Version
History
(Read) 1.0 2/1/2001 Tested
(Write) 1.0 2/1/2001 Tested
See
Also
Data, DataB,
DataArray, DataRec, DataRecB