TIP: Click on subject to list as thread! ANSI
echo: delphi
to: ALL
from: TONY DUNN
date: 1997-09-15 23:30:00
subject: SQL Results display (not grid)

Hello All
Something of a cosmetic problem as much as a technical one. Delphi 2.0 
esktop
and Paradox 5.0 tables.
I want to display the results of an SQL query in either a list box or combo
box, rather than a grid, which is how I have it working presently. The way I
have it working currently is a form for entering the search criteria which 
calls
a TQuery object on the SQLResultsForm, like this:
procedure TFindForm.BitBtn1Click(Sender: TObject);
begin
if RadioGroupOptions.ItemIndex = 0 then
   begin
   SQLResultsForm.Query.Close;
   SQLResultsForm.Query.SQL.Clear;
   SQLResultsForm.Query.SQL.ADD('Select * from CD WHERE CD.CDTITLE like
:findvar
   SQLResultsForm.Query.Params[0].AsString := '%' + FindForm.EditFind.Text +
'%'
   SQLResultsForm.Query.Open;
   FindForm.Close;
   SQLResultsForm.DBGrid1.Visible := True;
   SQLResultsForm.DBGrid2.Visible := False;
   SQLResultsForm.Show;
   end;
This works OK as it returns the records to the DBGrid, but it looks ugly, if
nothing else because I haven't sussed a way of making the width of the DBGrid
match the combined width of the displayed fields (any offers of help?). What 

want instead of the grid is for a listing of *all* the found records with 
(say)
only a handful of the fields displayed, or a combo box per field with all the
found records listable drop-downwards.
I can attach dbEdit boxes and use dbNav to move through the returned dataset,
but I'd prefer the user to be able to either scroll a list, or pick the 
ecord
they are interested in from a drop down listing of those returned by the 
Query.
Any help appreciated, replies via email please for speed
Regards
Tony 
--- GEcho/32 1.20/Pro
---------------
* Origin: Tony's Point of View (2:250/102.2)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.