Jump to content
Sign in to follow this  
Odlarhg

How to populate DBLookupComboBox?

Recommended Posts

Hi,

I need to populate a DBLookupComboBox with data from an SQL Server table. I don't have much experience with Delphi and although I created the DBLookupComboBox I can't populate it.

This is what I have done at the moment.

 

  1. Create a TADOConnection to the database that contains the table
  2. Create a TADOQuery
  3. Create a TDataSource
  4. Then create the DBLookupComboBox
  5. In the properties of DBLookupComboBox
    1. I assigned the DataSource using the TDataSource that I créated
    2. I assigned the Id field in KeyField
    3. I assigned the Name field in ListField

 

With the above I understand that it should work, but as I said I do not have much experience with Delphi and I do not know what else I should configure so that the DBLookupComboBox can be populated with the data in the table.Could you help me?

 

Share this post


Link to post

Hi Odlarhg,

The component's Datasource/DataField are the main table.

You need to assign the ListSource/ListField/KeyField to the Table you are looking up.  The Key field should match the DataField.

HTH

Ian

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×