Board index » delphi » run query and storage result to tstringlist

run query and storage result to tstringlist

    What is the best way to execute a Tquery and storage result
in a tstringlist, like the savetofile do... Now i am saving in a file
and create a tstringlist and load from file, any way to make this
direct?

    Thanx all

 

Re:run query and storage result to tstringlist


The way I'd do it is to iterate through the result set and add the fields to
the TstringList:

with Query1 do
begin
  First
  while not eof do
  begin
    lList.Add([FieldValuse]);
    Next;
  end;
end;
lList.SaveToFile(FileName);

lList is declared and created as TStringList; [FieldValues] = Either
FieldByName('').AsString/Query1FieldName.AsString.

regards

Quote
"Cristian" <crist...@ivirtua.com.br> wrote in message

news:3bbbecca_2@dnews...
Quote

>     What is the best way to execute a Tquery and storage result
> in a tstringlist, like the savetofile do... Now i am saving in a file
> and create a tstringlist and load from file, any way to make this
> direct?

>     Thanx all

Other Threads