Hello,
The overall idea seems to be OK, but I've found a few mistakes:

1) you should NOT call MemHandleUnlock(memrec) - memrec is a pointer, not a
handle and you have unlocked newHandle before.
2) Do you call DmReleaseRecord after you finished using this record ? I see
that you use this record in "read only" mode here, so you can use
DmQueryRecord instead, and you don't need to call DmReleaseRecord after it.

Robert

"Alexandre Barreto" <[EMAIL PROTECTED]> wrote in message
news:103368@palm-dev-forum...
>
>
>
> I'm tryigng to read the first record of a databse.... i tried many tims ad
> nothing work..
> can someno  explain me how to do that
> statrting form open the databse.. i'm new on palm programing
>
> i dit this:
>
> img = DmOpenDatabaseByTypeCreator('IMGD','MOST',dmModeReadWrite);
>
> // Get a handle for the first record.
> recHandle = DmGetRecord(img, 0);
> // Lock down the handle and get a pointer to the record data.
> recbyte = MemHandleLock(recHandle);
> // Allocate a new memory chunk that will contain a copy of the data.
> newHandle = MemHandleNew(StrLen(recbyte) + 1);
> // Lock down the handle and get a pointer to the memory chunk.
> memrec = MemHandleLock(newHandle);
> // Copy the data from the record to the new memory chunk.
> StrCopy(memrec, recbyte);
> // Unlock the new memory chunk.
> MemHandleUnlock(newHandle);
> MemHandleUnlock(recHandle);
> MemHandleUnlock(memrec);
>
>
> it was suposed to get all the first record in the memory area handled by
> memrec...
>
> can somenone tell me how to do that??
> cause i need to read the record byte by byte
>
> thnx a lot
>
> _________________________________________________________________
> MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com
>
>
>



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

Reply via email to