BCB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[BCB] Access comma delineated data in TDBMEMO field in Database withou t using strtok




I have a database with a memo field with comma delineated data.  I would
like to know how to access the individual strings[] and count value.  It
seems you can not use the TMemo methods and properties on TDBMEMO.  I have
to load the whole memo field as one big string and use strok (see below).
Is there a better way?  Possibly using AnsiString function?

for (char *specString = strtok(FormEquipment->Table1->FieldByName("Temp_Spec")->AsString.c_str(),",\n");
                specString;  specString = strtok(NULL, ",\r") {
    String SpecString = specString;
    String s = FormEquipment->Table1->FieldByName("Temp_Spec")->AsString;
    SpecString.TrimLeft();
    switch (SpecString[1]) {
      case '#': SpecString.Delete(1,1);
        InputLocSpec->Add(SpecString.ToInt());
        SpecString = specString = strtok(NULL, ",\n");

        InputLocValueLoSpec->Add(SpecString.ToDouble());
        SpecString = specString = strtok(NULL, ",\n");

        InputLocValueHiSpec->Add(SpecString.ToDouble());
        SpecString = specString = strtok(NULL, ",\n");
        channelLoc_X->Add(SpecString.ToInt());
        SpecString = specString = strtok(NULL, ",\n");
        channelLoc_Y->Add(SpecString.ToInt());
        SpecString = specString = strtok(NULL, ",\n");
        locLabel_X->Add(SpecString.ToInt());
        SpecString = specString = strtok(NULL, ",\n");
        locLabel_Y->Add(SpecString.ToInt());
        SpecString = specString = strtok(NULL, ",\n");
        LabelInputLoc->Add(SpecString.TrimLeft());              // Load Label string.
        SpecString = specString = strtok(NULL, ",\n");

        ErrorMessageInputLoc->Add(SpecString.TrimLeft());       // Load Error message.
        break;




Regards;
Len Richter
email   len@nospam.campbellsci.ca


W Komornicki's Home Page | Main Index | Thread Index