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/

Reply via email to