Purpose
Used to append a new record to the end of the database.
Syntax (Method)
object.AppendB
pKey, pData
| pKey
(String) |
|
The
new record's key is assigned this value. |
| pData
(Byte Array) |
|
The
new record's value. |
Notes
This method allows duplicate keys to exist in the database. Hence,
if this method is called with a key (pKey)
that already exists in the database, a new record will still be appended
with the specified key (pKey).
Error
Values
After calling this method, the property ErrorNumber
will report one of the following values:
rtCDP_ErrNoError
rtCDP_ErrDatabaseFull
rtCDP_ErrKeyTooLong
rtCDP_ErrDataTooLong
Example
Objective:
Store a picture from disk to a database file.
'Create the object
Dim CDP As
rtCDP.rtCompactDataPak
Set CDP = New rtCDP.rtCompactDataPak
'Get the filespec, free file number, resize the
data buffer
Dim
FileName As
String: FileName
= "C:\MyPicture.bmp"
Dim FileNumber As
Long: FileNumber
= FreeFile
Dim DataBuffer() As
Byte: ReDim DataBuffer(FileLen(FileName))
'Open the file, load the data buffer, close the
file
Open FileName For
Binary Access Read As #FileNumber
Get #FileNumber, , DataBuffer
Close #FileNumber
'Finally, transfer the picture to a new record
CDP.AppendB "Picture", DataBuffer
CDP
now has 1 record containing the picture "C:\MyPicture.bmp"
| Rec |
Key |
Data |
| 0 |
Picture |
<binary
data> |
Version
History
1.0 2/1/2001 Tested
See
Also
Append, Data,
DataB, Insert, InsertB