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
Solved

ADOQuery + ComboBox

Posted on 2003-10-24
3
706 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
indy Tmemory stream non latin charcter issue 2 121
creating threads in delphi 1 134
how to resize animated Gif image in delphi ? 1 35
Breakpoint doesn't stop in my variable 3 30
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

829 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