[from the archive snip....]

Another alternative to modify an existing record is to:

1) Use DmNewHandle to create a chunk to contain the new contents of the
record.
2) Use MemHandleLock, DmWrite, and MemHandleUnlock to fill in the contents
of the new record.
3) Use DmAttachRecord to put replace an existing record with the new one.
4) Use MemHandleFree to free the chunk with the old contents of the record.

The other question I have is what handle is used in the MemHandleFree()
call?
Here is my code as it stands:

                        // following archive procedure for updating a record
with new data.
                resultRec = DmNewRecord(CrewResDB, &index, sizeof(ResultType));

                // Lock down the block containing the new record.
                p = MemHandleLock(resultRec);

                // Write out the entire result record - title and all.
                error = DmWrite(p, index, &Result, sizeof(Result) );

                DmAttachRecord(CrewResDB, &index, resultRec, oldHP);

                MemHandleUnlock(resultRec);

                // old record
                resultRec = DmGetRecord(CrewResDB, CurrResRecord);
                MemHandleFree(resultRec);  //wasn't sure what handle to pass this
function...


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