To help figure out what is causing "Err getting rec" try using
DmGetLastErr() right after the DmGetRecord statement that is the source of
the error.

Example:

VoidHand        vh;
Err             err;
char            errorText[50]; // declare a place to store the SysErrString error
message

vh = DmGetRecord (dbRef, recNum);
if (vh == 0)
{
  // A problem occured while getting the record.
  err = DmGetLastErr ();
  ErrDisplay (SysErrString (err, errorText, 50));
}

// See the Palm documentation for DmGetLastErr, ErrDisplay, and
SysErrString.

Mitch Fawcett
Tapn'see Software
Home of SuperList2
http://www.tapnsee.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of John
Leung
Sent: Friday, October 13, 2000 3:02 AM
To: Palm Developer Forum
Subject: Re: What am I doing wrong here?


I don't see what's wrong.  I only have one question for you.  Did you
open your database in read-only mode?  If you did, you'll get a fatal
error when you try to create a new record.


On Thu, 12 Oct 2000 22:12:39 -0400, "Sean L. Gilley"
<[EMAIL PROTECTED]> wrote:

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



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