Hi folks.
I'm trying to get familiar with using databases, and am a bit confused
regarding how to keep track of multiple records. I've read that one must
create an integer variable, which would store the record index numbers that
are obtained via DmFindSortPosition. I'm a little confused over this in that
supposing I want to have a database with say 5 records. In that case how can
I retrieve any of the 5 records when I start the application afresh? In
other words, even if I have a variable that holds the index number of the
record I've just written to, wouldn't this number be reset when I restart my
application?
Here's the code I have, which is transfers text from a field into a record:
namePtr =
FldGetTextPtr((FieldPtr)GetObjectPtr(MainUnnamed1002Field));
nameLen = StrLen(namePtr) + 1;
newRecordHandle = DmNewHandle (dbRef, nameLen);
newNameRecord = MemHandleLock(newRecordHandle);
DmWrite(newNameRecord, 0, namePtr, nameLen);
prefs.recordNum = DmFindSortPosition(dbRef, newNameRecord, 0,
(DmCompareF*)CompareFunc, 0);
MemHandleUnlock(newRecordHandle);
"prefs.recordNum" is an integer inside of a struct that holds the record
index number.
I would really appreciate any help/comments on this. Thanks in advance.
regards,
Akshay Shende
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/