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 without using strtok
I have used a dummy ListBox to make life easier. The assignment loads up
the list box and then I can use the list box methods. I would think a
variant of it would work for a TDBMEMO field as well
An example of how I have used it.
ListBox1->Items->CommaText = Memo2->Lines->Strings[0]
-- Mike
----- Original Message -----
From: Richter, Len <Len@nospam.campbellsci.ca>
To: 'BCB Mailing List' <bcb-list@nospam.orionlink.net>
Sent: Friday, April 30, 1999 9:27 AM
Subject: [BCB] Access comma delineated data in TDBMEMO field in Database
without 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