Hi All,

I am still having problems.  This is my first time using databases and I am
missing something.  I have a data base that I created using DBMaker (which
converts a .csv file and converts it to a .pdb file).  These files are not
intended to be edited by the Palm user.  I can open them without any errors
but the reading part is a problem.  I do not know if DBMaker uses a packed
or unpacked format(that may be part of my problem).  At this point I am just
trying to get the first string in each record entered into a popuplist on in
my MainFormInit().  The first string may be used in multiple records but
they are sorted so that they occur one after the other.  Hence, I am doing a
check to make sure duplicates do not get entered into the list.  Currently,
only the "None" gets loaded into the list.  So, below is my code as it
stands.  I could really use some ideas, databases are not my fortae.  I can
not help but think that this must be a lot easier than I am making it.
Thanks!

Best Regards,

Chris Engler

typedef struct ListOneType
{
 Char * string1;
 Char * string2;
 Char * string3;
 UInt16 value1;
} ListOneType;

Char * gList[31];
DmOpenRef gDB;
ListOneType Record;

gList[indexLst] = "None";
 indexLst++;
 if(gDB)
 {
  numRecords = DmNumRecords(gDB);
  if(numRecords)
  {
   MemHandle recordH = 0;
   Char * text = NULL;
   ListOneType * record;

   for (indexDB = 0; indexDB<numRecords; indexDB++)
   {
    recordH = DmQueryRecord(gDB, indexDB);
    if (recordH)
    {
     record = (ListOneType *)MemHandleLock(recordH);
     Record = *record;
     if (!StrCompare(Record.strin1, gList[indexLst-1]))
     {
      gProdList [indexLst] = Record.Product;
      indexLst++;
     }
     MemHandleUnlock(recordH);
    }
   }
  }
 }
 gList[indexLst] = NULL;
 list = (ListPtr)GetObjectPtr(StrList);
 if (list)
 {
  LstSetListChoices(list, gList, indexLst);
  LstSetHeight(list, indexLst > 10 ? 10 : indexLst);
  LstSetSelection(list,0);
  CtlSetLabel(GetObjectPtr(StrTrigger),LstGetSelectionText(list,0));
 }



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

Reply via email to