Get data from adoquery to string list

Good. I have a query that should return all problem numbers. I would like to get every number number to be returned and add it to the list of strings.

ADOQuery1.SQL.Clear;
SQLQuery := 'SELECT issue FROM Comics WHERE SeriesName = '+Quotedstr(SeriesName)+' AND Volume = '+quotedstr(VolumeNumber);

ADOQuery1.SQL.Add(SQLQuery);
ADOQuery1.Active := true;

So, as soon as I realized that the best way to get the results in a list of strings. I tried to use it ADOQuery1.GetFieldList(issuelist,'issue');, but wants tlistnot tstringlistto be sure if it really matters or if I am even doing it right.

+3
source share
1 answer

You do not want to use GetFieldList. This returns a list of the field object in the dataset. You need to do something like this:

ADOQuery1.Open;
ADOQuery1.First;
while not ADOQuery1.Eof do
begin
  issuelist.Add(ADOQuery1.FieldByName('issue').AsString);
  ADOQuery1.Next;
end;
+8
source

All Articles