Solved

Basic question...

Posted on 2000-02-16
6
193 Views
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
0
Comment
Question by:Marcelito
6 Comments
 
LVL 2

Expert Comment

by:aubs
Comment Utility
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

Aubs
0
 

Expert Comment

by:hobbit123
Comment Utility
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;
 
                   Hobbit123

0
 
LVL 1

Expert Comment

by:JoeBooth
Comment Utility
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
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Expert Comment

by:ITugay
Comment Utility
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);
begin
   DBCombobox1.Items.Clear;
   DBCombobox1.Items.Add('000');
   DBCombobox1.Items.Add('001');
   DBCombobox1.Items.Add('02');
   DBCombobox1.Items.Add('text');
// you may fill list by values from anoter table
end;

Cheers,

Igor.
0
 

Expert Comment

by:GoodTimes
Comment Utility
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
begin
   First;
   while not EOF do
   begin
      DBCombo.Items.Add(FieldByName('ComboField').AsString);
      Next;
   end;
end;

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..
Omri
0
 

Accepted Solution

by:
Freaky earned 50 total points
Comment Utility

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 .. ;)

 Greets

  Sascha

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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now