Dear all,
I want to save some data in the DB, however i use the codes from
the tutorial of CW5, I found that it will save the data in a new record of
DB. Can anyone tell me that how can i save in the same record (overwrite
the exist record)?
Thank You
Gary
Here is the code of Save Function:
static void EditSaveData(FieldPtr fld)
{
CharPtr text;
VoidPtr textPtr;
VoidHand textHandle;
UInt index = 0;
text = FldGetTextPtr(fld);
if (text != NULL && *text != 0)
{
// it will make a new record to save, how can i make it overwrite
the existing record??
textHandle = DmNewRecord(MemoPadDB, &index, StrLen(text) +1);
textPtr = MemHandleLock(textHandle);
DmWrite(textPtr, 0, text, StrLen(text) + 1);
MemHandleUnlock(textHandle);
DmReleaseRecord(MemoPadDB, index, true);
}
}