There is this listbox which gets populated with the name of the columns of a database in Delphi (Radstudio, Firedac). Depending on the listboxitem selected by the user, the data of the relevant column should then be loaded into another listbox.
To read that specific column I use the following code:
SQL.Add ('SELECT '
+ QuotedStr(Trim(ListBoxName.Selected.Text))
+ ' from TABLE_NAME');
open;
so far so good. However, when I try to access the data of the column, an error is raised saying the 'Field ... not found'.
ListBoxItem.Text := VarToStr(FieldValues[ListBoxName.Selected.Text]); ==> Field 'field_name' not found!
I guess the problem is with the qoutedstr() in the first line. But not using it causes errors with the name of the columns with numbers and . in them.
So, what am I doing wrong?