Have you tried to adding it to the end of the end of the database?

index = dmMaxRecordIndex;

-- 
-------------------------------------------------------------------------
DataGet & PocketLog  www.dataget.com
Baxter Codeworks          www.baxcode.com
-------------------------------------------------------------------------


"NGrant.com" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi

I have been having a little trouble with the call DmRecordInfo, from the
doco I believe that uniqueIDP should return a "unique" value, this code
doesnt it is always the same value, which obviously isnt "unique".

This must be something simple but I cannot get past this problem.

Any one got any ideas ?

 Ptr   pRec;
 VoidHand memoRec;
 Err   error;
 UInt      mode;
 DmOpenRef MemoPadDB;
 UInt32  memoPadDBType = 'DATA';
 UInt16  index;
 UInt32   uniqueIDP = 0;
 mode = dmModeReadWrite;
    MemoPadDB =  DmOpenDatabaseByTypeCreator(memoPadDBType, sysFileCMemo
,mode); //memoPadDBType is 'DATA'
// Get index of new memo record to be added.
 index = 0; // befinning of DB

 // Create a new record in the database
 memoRec = DmNewRecord(MemoPadDB, &index, StrLen(data) + 1);
 // Lock down the block containing the new record.
 pRec = (Char*)MemHandleLock(memoRec);
 DmStrCopy (pRec, index , data);
 // Unlock the block of the new record.
 error = MemPtrUnlock(pRec);
 if (error != 0)
  return error;
 error = DmReleaseRecord (MemoPadDB, index, true);
 if (error != 0)
  return error;

   error = DmRecordInfo( MemoPadDB, index, NULL, &uniqueIDP, NULL);
 if (error != 0)
  return error;
// Debug -> display the value, always 16
 gUniqueIDP = uniqueIDP;

    char buf[32];

     //send received data to display
     StrPrintF(buf,"gUniqueIDP: %i", gUniqueIDP);

    FrmCustomAlert
    (
     DebugScreenAlert ,
     "No error on create of memo",
     "gUniqueIDP",
     buf
    );

// Debug -> display the value, always 16


 // Close the application's database.
 DmCloseDatabase(MemoPadDB);

I have tried the DmRecordInfo before the release as well, but no joy :(




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

Reply via email to