Your total absence of error checking is very disturbing.
Try checking the return code of each AP call to make sure it
succeeded before continuing, and then see if you are getting an
unhandled error.
Roger Stringer
At 03:15 AM 2/11/2006, you wrote:
Subject: Problem to create the first record of my database
From: [EMAIL PROTECTED]
Date: Fri, 10 Feb 2006 13:11:28 -0000
X-Message-Number: 2
Hello,
I create a database and I want to store records in it. The problem
is that when I want to create the first record, the function
"DmNumRecords" returns 83 and not 0 ! If I create the first record
with the index 0, everything seems good but the record is not
created (I use the View databases tool of the emulator). After, if I
add some other records, it works and they are well stored in the DB.
Heres is an extract of my code :
//Create the database
DmCreateDatabase (0, "cmlgaumontstatdb", 'CEDM', 'DATA', false);
//Retrieve database ID
DBId = DmFindDatabase (0, "cmlgaumontdb");
//Open the database
DBOpenRef = DmOpenDatabase (0, DBId, dmModeReadWrite);
//Retrieve the number of records (the first time I read 83)
index = DmNumRecords (DBOpenRef);
//Create the record
pNewRecord = DmNewRecord (DBOpenRef, &index, iRecordLength);
//Set the record
pRecord = MemHandleLock (pNewRecord);
DmWrite (pRecord, 0, pRecordContent, iRecordLength);
MemPtrUnlock (pRecord);
DmReleaseRecord (DBOpenRef, index, false);
What do I do wrong (knowing that it works for all others records)
?Could it be a bug of the emulator ?
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/