Basic question...

Posted on 2000-02-16
Last Modified: 2010-04-04
I have a simple query like this

Select * from <Table>

when I put a DataSource and a DBCombo, the DBCombo not show the data. The Combo only show the first record of dataset.

Any idea?

Thanks, Marcelo
Question by:Marcelito
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 2526828
The idea of the DBCombobox is that you fill the items list yourself to allow the user to select an appropriate one for the field.

If you are expecting to see all the records of a particular field in a combo box use the DBLookupComboBox


Expert Comment

ID: 2526829
I don't understand. You want do use a TDBComboBox component with TDataSource? You need to set DataSource and DataField properties and everything should be fine. If you want to see a next record, you should call <YourDataSetName>.Next;


Expert Comment

ID: 2526896
Use a DBLOOKUPCOMBO instead of a DBCOMBO and set the ListSource and ListField properties to the datasource and field name.

DBCOMBO expects you to fill the list box and controls what gets entered into the field.

DBLOOKUPCOMBO fills the list box with items from the dataset specified in the Listsource
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Expert Comment

ID: 2526900
Of course, you will see nothing, if you place nothing in TDBComboBox.Items.
You can fill it at design time by enter desired values manually, or in runtime.
In runtime you may do it like this:

in designmode define OnDropDown event.

procedure TForm1.DBCombobox1.DropDown(Sender: TObject);
// you may fill list by values from anoter table



Expert Comment

ID: 2531913
DBComboBox is intended to allow the user to pick a value for a specific field. It is not intended to select a record in the database.
If you want to fill the DBComboBox with data from the table do the following:

with Table do
   while not EOF do

This should add the values in the table to the dbcombobox.
put in FieldByName the name of the field which the dbcombobox is supposed to represent.

I hope this explains things a bit..

Accepted Solution

Freaky earned 50 total points
ID: 2551984

The only data-sensitive thing in a DBComboBox is the editfield.
The dropdown-list does not contain the records from your query.

Try to insert the datarows like "GoodTimes" explained above, but set a "DBComboBox.Items.Clear" just behind the "Table.First" or your list will be quite full after some expandings .. ;)



PS: Sorry for my bad English - German is easier, I think .. ;)

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month4 days, 15 hours left to enroll

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question