Hi All,
I have read through all the listings I can find on populating a list from a
database and am still having problems with a NULL string passed. Below is a
sample of my code. It works fine untill the data base is present, then it
has problems. I have a four column database with a couple hundered entries
and several in the first column are repeated so, I do a check so I don't
load the same choice into the array several times. I would really
appreciate it if someone could aim me in the correct direction. Any help is
appreciated!
Best Regards,
Chris Engler
Char * gList[31];
gList[indexLst] = "None";
indexLst++;
if(gDB)
numRecords = DmNumRecords(gDB);
if(numRecords)
{
MemHandle recordH = 0;
Char * record = NULL;
Char * text = NULL;
for (indexDB = 0; indexDB<numRecords; indexDB++)
{
recordH = DmQueryRecord(gDB, indexDB);
if (recordH)
{
record = MemHandleLock(recordH);
if (!StrCompare(record,gList [indexLst-1]))
{
gList [indexLst]= record;
indexLst++;
}
MemHandleUnlock(recordH);
}
}
}
list = (ListType *)GetObjectPtr(TypeList);
numRecords = sizeof(gList);
LstSetListChoices(list, gList, numRecords);
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/