You open your database in read only mode !
Try read/write mode instead
----- Original Message -----
From: "Stringer" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Friday, March 07, 2003 5:07 PM
Subject: RE: Error With Adding a Record to a Database
> >Subject: Error With Adding a Record to a Database
> >From: Brandon Sean Fogerty <[EMAIL PROTECTED]>
> >Date: Thu, 6 Mar 2003 18:52:02 -0700
> >X-Message-Number: 39
> >
> > Hi! I am trying to add a record to a database. my code compiles fine
> > however, I keep getting Memory NULL Handle runtime errors on my palm.
> > This is what I did
> >
> >struct DATATEST
> > {
> > UInt16 score;
> > };
> > DmCreateDatabase(0,"Testdb",1,1,false);
> > LocalID id=DmFindDatabase(0,"Testdb");
> > DmOpenRef dbRef=DmOpenDatabase(0,id,dmModeReadOnly);
> > UInt16 Index=dmMaxRecordIndex;
> > DATATEST Score;
> > //score.text="BrandonFogerty";
> > Score.score=10;
> > MemHandle handle=DmNewRecord(dbRef,&Index,200);
> > void* recPtr=MemHandleLock(handle);
> > DmWrite(recPtr,0,&Score,sizeof(DATATEST));
> > MemPtrUnlock(recPtr);
> > FrmAlert(SaveAlert);
> > Any ideas? Thanks!
> >
>
> Try checking return codes. This may seem a novel concept, but
> if one of API call fails, it will return something (typically NULL) which
> will cause the next API call to fall flat on its face. That is what you
are
> seeing!
>
> Checking return codes will eliminate that problem.
>
> Roger Stringer
> Marietta Systems, Inc. (www.RF-TP.com)
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/