12\x00Amy Chan\x00
3456789\x00Ben Yau\x00
Provided the student ID, I want to get his name. The following function gets fatal error at MemHandleLock(). Please help.
Err GetStudentName(DmOpenRef dbP, Char *stdID, Char *stdName)
{
Err err = errNone;
Int16 numRecords;
Int16 index;
Boolean found = false;
char *text;numRecords = DmNumRecords(dbP);
if (numRecords > 0)
{
for (index=0; index<numRecords && !found; index++)
{
MemHandle recordH = DmQueryRecord(dbP, index); if (recordH)
{
text = (char *) MemHandleLock(recordH); // fatal alert
here, free handle if (text!= NULL && StrCompare(text, stdID) == 0)
{
text += StrLen(text) + 1; // get student name
found = true;
StrCopy(stdName, text);
} MemHandleUnlock(recordH);
}
}
}return err; }
_________________________________________________________________
Linguaphone : Learning English? Get Japanese lessons for FREE http://go.msnserver.com/HK/30476.asp
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
