I would call on my application which will store information into a database 
but once I exit the application and reopen it, all the information in the 
database is gone but there's a record of of it being there.  ...I dont' know 
if I explained it well....

The code below, is where I add information into the database.

emailDB = DmOpenDatabaseByTypeCreator (DBType, DBCreator, dmModeReadWrite);
 index = DmNumRecords(emailDB)-1;
 H = DmGetRecord(emailDB, index);
 if (H){
  tempInDBP = (answer *)MemHandleLock(H);
  tempInDB = *tempInDBP;
  tempInDB.bodyOfEmail = subject_email;
  DmWrite (tempInDBP, 0, &tempInDB, sizeof(tempInDB));
  MemPtrUnlock(tempInDBP);
  DmReleaseRecord(emailDB, DmNumRecords(emailDB)-1, true);
 }


The following code happens before:  In my appStart() It checks to see if 
there was anything in a database.  If there was, then it would process it 
into an email and send it.
But I get an error.  And when I was debugging, it shows that there was a 
record but in the record, there is no information stored.  Is there 
something wrong with my code?

emaildbID = DmOpenDatabaseByTypeCreator (DBType, DBCreator, 
dmModeReadWrite);
 if (emaildbID){
  recordNum = DmNumRecords(emaildbID);
  if (recordNum > 0){
   MemHandle recordH = DmQueryRecord (emaildbID, recordNum-1);
   record = MemHandleLock(recordH);
   UnpackMail (&toStore, record);
   header = MemPtrNew (StrLen(toStore.dateOfRecord)+1);
   body = MemPtrNew (StrLen(toStore.bodyOfEmail)+1);
   StrCopy(header, toStore.dateOfRecord);
   StrCopy(body, toStore.bodyOfEmail);
   MemHandleUnlock(recordH);
   DmReleaseRecord (emaildbID, recordNum-1, true);
   DmRemoveRecord(emaildbID, recordNum-1);
   toSend.dateOfRecord = header;
   toSend.bodyOfEmail = body;

  }
  DmCloseDatabase(emaildbID);
  if (recordNum > 0)
   EMailContact(toSend);
  MemPtrFree(header);
  MemPtrFree(body);

 }
 else
  err = DmCreateDatabase (0, DB_Name, DBCreator, DBType, false);
 MemPtrFree(record); 



-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to