procedure TForm1.Button1Click(Sender: TObject);
begin
DataSource1.DataSet := adoquery1;
DbMemo1.DataSource := DataSource1;
DbMemo1.DataField := 'description';
with adoquery1 do
begin
if Active then Close;
SQL.Clear;
SQL.Add('Select description from Rooms');
//adoquery1.Active := true; you don't have to make the query active as you open it in the next line.
Open;
end;
end;
Now, your dbMemo should be filled with the text from the first record in the dataset. So, you have to loop through dataset to get what do you need.
For debugging, I put watches and use DataSet.FieldByNAme('column_name').asString to see the value in the current record.
Cheers,
Ionut
Ionelul
Junior Poster in Training
94 posts since Dec 2009
Reputation Points: 17
Solved Threads: 27