Sorry, Scott, but your comment is simply wrong.

The format of the DmWrite call is
Err DmWrite(
        void *recordP,          // destination
        UInt32 offset,          // offset within destination
        const void *srcP,       // source
        UInt32 bytes)           // number of bytes to write
(this, sans comments which I added) is from DataMgr.h.
DrumBSF's code DOES write from newRecord to newRecordPtr
(assuming that the database got opened/created ok), it 
just does it twice...

-bob mckenzie


-----Original Message-----
From: Scott Herman [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 22, 2001 9:25 AM
To: Palm Developer Forum
Subject: Re: We have read the docs!


There is no association between newRecord & newRecordPtr. newRecordPtr
refererences your record, but you're writing your data to newRecord
which is NOT what newRecordPtr references.




At 10:53 AM 6/22/01 -0400, [EMAIL PROTECTED] wrote:
>              We have read the docs and we have a question on how o save
the text in our field. This is our code. 
>
>gDb=DmOpenDatabaseByTypeCreator(yourdbtype,yourapptype,dmModeReadWrite);
>
if(! gDb) DmCreateDatabase(0,yourdbname,yourapptype,yourdbtype,false);
>
DmOpenDatabaseInfo(gDb,&theLocalID,NULL,NULL,&theCardNum,NULL);
>
DmDatabaseInfo(theCardNum,theLocalID,NULL,&theAttributes,
>
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
>                                         theAttributes |= dmHdrAttrBackup;
>                                         theCardNum=0;
>
DmSetDatabaseInfo(theCardNum,theLocalID,NULL,&theAttributes,
>
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
>                                         if (adding)
>                                             {
>
myRecordHandle=DmNewRecord(gDb, &RecordIndex, sizeof(newRecord));
>                                                 newRecordPtr=(OurStruct
*)MemHandleLock(myRecordHandle);
>                                                 newRecord.cost=Coster;
>
newRecord.serialnum=Serial;
>                                                 newRecord.datefield=Dater;
>                                                 newRecord.itemname=Namer;
>                                                 newRecord.lin=Lin;
>                                                 newRecord.nsn=Nsn;
>
DmWrite(newRecordPtr,0,&newRecord,sizeof(newRecord));
>
DmWrite(newRecordPtr,0,(CharPtr) &newRecord->serialnum,sizeof(newRecord));
>
MemHandleUnlock(myRecordHandle);
>                                                 
>                                             }
>
>Our code works and actually saves records but in the records, our field's
text is not in there. Please help us! Thanks!
>
>
>
>                         GOD Bless!!!
>
>-- 
>For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/

                                           Scott Herman
                                           Laboratory Automation Section
    _| _/  __|   _/  _/    _/  _/    _/    Department of Laboratory Medicine
    _|_/  _/_|  _/  _/    _/  _/    _/     Yale New Haven Hospital
    __/  _/ _| _/  _/_/_/_/  _/_/_/_/      20 York Street
    _/  _/  _|_/  _/    _/  _/    _/       New Haven, Connecticut  06511
   _/  _/   __/  _/    _/  _/    _/        (203) 688-2449
                                           [EMAIL PROTECTED]



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

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