Purpose
Used to delete a record from the database.
Syntax (Method)
object.DeleteArray
Key, Instance
| Key
(String) |
|
This
is the key of the record you want to delete. |
| Instance
(Long) |
|
This
is the instance of the record named with the specified key you
want to work with.
Key
and Instance
work together to specify a record. For example, if Instance
is 3, then the property specifies the 4th (zero-based) record
that is named Key.
This
parameter is zero-based.
Negative
values are bound to zero (0).
|
Notes
If the specified record exists, the record is deleted and the ErrorNumber
property returns rtCDP_ErrNoError.
If
the specified record does not exist, no records are effected and the
ErrorNumber
property returns rtCDP_ErrRecordNotFound.
If
any errors occur, no records are effected.
Error
Values
After calling this function, the property ErrorNumber
will report one of the following values:
rtCDP_ErrNoError
rtCDP_ErrKeyTooLong
rtCDP_ErrRecordNotFound
Example
Objective: Append and then delete a record from the database.
'Create
a database
Dim CDP As
rtCDP.rtCompactDataPak
Set CDP = New rtCDP.rtCompactDataPak
'Add
some records to the database
CDP.Append "Name", "Amanda"
CDP.Append
"Name", "Susan"
CDP.Append
"Name", "Beth"
This
is the current state of the database:
| Rec |
Key |
Data |
| 0 |
Name |
Amanda |
| 1 |
Name |
Susan |
| 2 |
Name |
Beth |
'Now,
delete a record in the database
CDP.DeleteArray
"Name", 1
This
is the current state of the database:
| Rec |
Key |
Data |
| 0 |
Name |
Amanda |
| 1 |
Name |
Beth |
'Now,
delete a non-existent record in the database
CDP.Delete
"Name", 1
'nothing changes
This
is the current state of the database:
| Rec |
Key |
Data |
| 0 |
Name |
Amanda |
| 1 |
Name |
Beth |
Version
History
1.0 2/1/2001 Tested
See
Also
DeleteAll,
Delete,
DeleteRec