populate ComboBox from query

edited 5:33PM in FastReport 4.0
Hy, my question is how to populate DialogPage ComboBox with results from a Query?

I've tried the following code:

VAR SQLQuery1 : String;

procedure ListBox1OnEnter(Sender: TfrxComponent);
begin
SQLQuery1 := 'Select F_ACRONYM from Customer';
ListBox1.Items.Add(ToStr(QueryValue(SQLQuery1)));
end;

My problem is that I can't get all the names from the result in my ComboBox, it takes only the first name.

Can anyone help me?

regards,
CsAlex

Comments

  • gpigpi
    edited 5:33PM
    var DS: TfrxDataSet;
    begin
        DS:=Report.GetDataset('Items');
        DS.First;
        while not DS.Eof do      
          begin          
            ListBox1.Items.Add(DS.Value('Part Name'));
            DS.Next;
          end;        
    end.
    
  • edited 5:33PM
    gpi wrote: »
    var DS: TfrxDataSet;
    begin
        DS:=Report.GetDataset('Items');
        DS.First;
        while not DS.Eof do      
          begin          
            ListBox1.Items.Add(DS.Value('Part Name'));
            DS.Next;
          end;        
    end.
    

    Thank you gpi, works perfectly [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />. Have a nice week![/img]

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.