I'm writing my first database code.  I copied this simple function out of
the Palm OS Programming Bible, but its not returning.  Or, it wasn't until I
made it quit when the count rose to 10000.  It seems so straight forward,
I'm at a loss what's going on.  Any insight would be greatly appreciated.

Thanks!
Rich

// The function call looks like this:
Int16 count = CountDBs('DATA', 'PCAD');

// Count the number of Databases
Int16
CountDBs(UInt32 type, UInt32 creator) {
    // (code from "Bible" pg. 385
    DmSearchStateType searchState;
    Int16 count = 0;
    UInt16 cardNo;
    LocalID dbID;

    if (DmGetNextDatabaseByTypeCreator(true, &searchState,
        type, creator, false, &cardNo, &dbID)
    {
         do {
             count++;
        } while (count < 10000 && DmGetNextDatabaseByTypeCreator(false,
&searchState,
            type, creator, false, &cardNo, &dbID));
    }
    return count;
}




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

Reply via email to