This is the code I use to loop through a database.
Cast the recP to whatever the record is your are bringing back

  VoidPtr recH;
  VoidPtr recP;
  Uint16 index = 0;
  
  while(true) {
     
    recH = DmQueryNextInCategory(PackedDB,&index, dmAllCategories);
    
    if (recH == NULL) {
      /********
      ** no more records so quit loop
      ********/
      break;
    } // if
    
    recP = MemHandleLock(recH);

    /*************************
    ** access your record here
    **************************/


    MemHandleUnlock(recH);
    index++;

  }

-----Original Message-----
From: Jim Garozzo [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 3:46 PM
To: Palm Developer Forum
Subject: Reading Next Database


Hi! I'm trying to figure out the easiest way to increment to the next
database location...I know this is simple.but my brain is drained.

Thanks for the help anyone can suggest.


Here's the code i'm writing...

  MemHandle h = DmQueryRecord(dbPtr, 0);        /* Opens the first Record of
my database
  // Make sure we got a good memory handle:
  if(!h)
   return 1;
  else
  {
   // Lock the handle, so we can read from it:
   Int16 *s = MemHandleLock(h);                        /* Retrieves data in
that record
   Int16 SysAlarmsDB = *s;


Now, how would I go about accessing my next database record which is at

MemHandle h = DmQueryRecord((dbPtr+1), 0);        /*  Note the adding of one
to the pointer



Now, I understand that this maybe total the wrong way..i'm new to PalmOS
writing and I'm looking at a database example that uses characters instead
of integers which is what i'm using.

Thanks again!

Jim



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

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

Reply via email to