Hi Vladimir ,
Thank u very much for this help ,I also need more help can we meet me in
chat ? Plz let me know if possible .
Once again thank u very much
Regards,
Ravindra Menge
Software Engineer
Sovika Infotek Ltd
An ISO 9001 Company
Call: 859 6969 , 851 6341 Ext:134
----- Original Message -----
From: "����� ��������" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Wednesday, October 03, 2001 2:08 PM
Subject: RE:DmWrite:DmWriteCheckFailed ..........please help me
Hi Ravindra
Until last time i have such problems: when i change a record,
DmWriteCheckFailed Error appears. Because i obtain a handle to � necessary
record with help of DmGetRecord. DmGetRecord return a handle to a record by
index and mark the record BUSY. If record is BUSY, DmWriteCheck return
dmErrNotValidRecord because it's impossible to resize and write to a record.
Because need to use DmQueryRecord function.
Follow function allow to write block data (BodyRec with size BodyLen) to a
new record (routine=0) or change having (routine=1).
file://---------------------------------------------------------------------
----
void WriteToDB(UInt16 routine,UInt16 nNumRecord,unsigned char
*BodyRec,UInt32 BodyLen)
{
MemHandle RecHandle;
MemPtr RecPtr,MemPtr;
UInt16 NumRecord,NumRec1;
Err dmErr;
if (routine==0)
{
NumRecord=DmNumRecordsInCategory(DB,dmAllCategories);
NumRec1=NumRecord;
if (!NumRecord) {
NumRecord=0;NumRec1=0;
RecHandle=DmNewRecord(DB,&NumRec1,BodyLen+1);
}
else RecHandle=DmNewRecord(DB,&NumRec1,BodyLen+1);
}
if (routine==1) {RecHandle=DmQueryRecord(DB,nNumRecord);NumRecord=nNumRecord;}
RecPtr=MemHandleLock(RecHandle);
MemPtr=MemPtrNew(BodyLen+1);
MemSet(MemPtr,BodyLen+1,0);
MemMove(MemPtr,BodyRec,BodyLen);
dmErr=DmWriteCheck(RecPtr,0,BodyLen+1);
if (dmErr==dmErrWriteOutOfBounds) {
MemPtrUnlock(RecPtr);
RecHandle=DmResizeRecord (DB,NumRecord,BodyLen+1);
RecPtr=MemHandleLock(RecHandle);
}
DmWrite(RecPtr,0,MemPtr,BodyLen+1);
MemPtrUnlock(RecPtr);
DmReleaseRecord(DB,NumRecord,false);
}
Best regards, Vladimir Shakin ([EMAIL PROTECTED])
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--------------------------------------------------------------
Nova Software, Mumbai, India
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/