Hi,

This might be due to the handle of the database that is passed to
DmCloseDatabase() i.e. gLibDB. The gLibDB might be NULL as you are passing
the db as the handle to the database for all the above operations used for
the database. So must free db variable using DmCloseDatabase();

Kamal

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chrix Bell
Sent: Thursday, May 26, 2005 12:41 PM
To: Palm Developer Forum
Subject: Why my application stopped after insert a new record?

Hi,all!
Sorry for the wrong coding format last message.

I make the codes below, I want to insert a new record into a database.
But the simulator just stopped at the last line of this routine. At this
moment, if I step over or force run,
the simulator will crash.
Could anyone help me about this?


void DBNewRecord(DmOpenRef db, DBRecord *record, UInt16 *indexP)
{
        UInt16 index;
        MemHandle newRecordH;
        DBRecord *newRecordP;
        index = DmFindSortPosition(db, &record, NULL,
                (DmComparF *) CompareDBRecords, NULL);
        newRecordH = DmNewRecord(db, &index, GetRecordSize(record));
        newRecordP = MemHandleLock(newRecordH);
        DmWrite(newRecordP, 0, &record, GetRecordSize(record));
        MemHandleUnlock(newRecordH);
        DmReleaseRecord(db, index, true);
        *indexP =index ;
        DmCloseDatabase(gLibDB);
}


Best regards,
Chrix




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

Reply via email to