I have a program with the following code.  This code only executes
the first time this version of the program is run.  After that, since
the records are created, the code is skipped.  The problem is that
the first time the program accesses the newly created record, it
gives a fatal error: "Err getting rec".  Once this happens, the 
program works correctly.

Since it seems to be related to the upgrade stuff, here's the code
that does the upgrade.  Am I doing something wrong?

        if(totitems < 16) {     
                for(i = totitems; i < 16; i++) {
                        recnum = i;
                        record = DmNewRecord(gDB, &recnum, sizeof(Balance));
                        if(!record) {
                                dAlert("ERROR: CB.1");
                                break;
                        }
                        bal_H = MemHandleLock(record);
                        bal.abalance = (Long)INITBALAMOUNT;
                        DmWrite(bal_H, 0, &bal, sizeof(Balance));
                        MemHandleUnlock(record);
                        DmReleaseRecord(gDB, recnum, true);
                }
        }

Sean.

---
Sean L. Gilley                              If the people are buying tears
614-860-0247 (h)                            I'll be rich someday.
[EMAIL PROTECTED]  

-- 
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