Solved

ADOQuery + ComboBox

Posted on 2003-10-24
3
703 Views
Last Modified: 2010-04-16
I have a ADOQuery and a ComboBox
i give a sql command
select * from stock where price>1000
all the selected fields i want to add in ComboBox
How can i do this ?
Thanks
0
Comment
Question by:fradolcino
3 Comments
 
LVL 1

Expert Comment

by:Qosai_DBA
ID: 9618928
Hi fradolcino

if I know you can concatenate all fields first like

SELECT field1 || field2 || field3 || ... || ... AS allfields FROM stock WHERE price>1000;

so the result of this Query is only one field and you can add the values to the ComboBox.

Regards
khalid.
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 45 total points
ID: 9618938
var
  i : integer;
  s : String;
begin
  adoquery1.open;
  while not adoquery1.eof do
  begin
    s := '';
    for i := 0 to adoquery1.fields.count-1 do
      s := s + adoquery1.Fields[i].AsString;
    combobox1.Items.add(s);
    adoquery1.next;
  end;
  adoquery1.Close;
end;

meikl ;-)
0
 
LVL 4

Expert Comment

by:brunomsilva
ID: 9620059
Hi,

why don't you use associate a datasource control with your query and then use it as a datasource for a dbLookupComboBox. Then you just have to set the KeyField propery to the field you want.

bye,
 Bruno
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

920 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

16 Experts available now in Live!

Get 1:1 Help Now