I've found a solution to the problem. Nothing like hard work and
determination :-)
--
Tim Astle
Tim Astle <[EMAIL PROTECTED]> wrote in message
news:8822@palm-dev-forum...
>
> Can someone give me an idea as to what could be causing this error?
>
> Fatal Error
> DataMgr.c Line:6294,
> DmWrite:DmWriteCheck
> failed
>
> I'm currently working on submitting information to the database. I have
it
> working, but now I need to modify the memory allocation for my strings,
etc.
> when submitting data of varying lengths to the database. I rewrote my
> current function, with one based off the Expense Database sample code.
>
> This is basically it. I'm trying to tackle strings right now... I'll
expand
> upon this later.
>
> Any suggestions would be greatly appreciated.
>
> void SetGeneral(FormPtr frm)
> {
> tblInfo theInfo;
> UInt curSize, newSize;
>
> VoidHand record = DmQueryRecord(gInfoDB, 0);
> tblPackedInfoPtr p = MemHandleLock(record);
>
> curSize = MemPtrSize(p);
> UnpackInfo( &theInfo, p);
> newSize = curSize;
>
> newSize += StrLen(FldGetTextPtr(FrmGetObjectPtr(frm,
> FrmGetObjectIndex(frm, NfoGeneralTripNumberField)))) -
> StrLen(theInfo.TripNumber);
>
> if(newSize > curSize)
> {
> MemPtrUnlock(p);
> MemHandleResize(record, newSize);
> p = MemHandleLock(record);
> UnpackInfo(&theInfo, p);
> }
>
> ChangeRecordField(p, curSize, FldGetTextPtr(FrmGetObjectPtr(frm,
> FrmGetObjectIndex(frm, NfoGeneralTripNumberField))), theInfo.TripNumber);
>
> if(newSize < curSize)
> MemPtrResize(p, newSize);
>
> MemPtrUnlock(p);
> }
>
>
> static void ChangeRecordField(tblPackedInfoPtr src, ULong size, VoidPtr
> data, CharPtr field)
> {
> ULong offset;
> ULong bytes;
> CharPtr ptr;
>
> // Move the rest of the record
> offset = (field - (CharPtr)src) + StrLen(data) + 1;
> ptr = field + StrLen(field) + 1;
> bytes = size - (ULong)(ptr - (CharPtr)src);
> if(bytes)
> DmWrite(src, offset, ptr, bytes);
>
> // Write the new field
> offset = (field - (CharPtr)src);
> DmStrCopy(src, offset, data);
> }
>
>
> --
>
> Tim Astle
>
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html