Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 2 of 2 total |
query fieldname - into stringgrid |
Tue, Jan 2 2007 5:14 AM | Permanent Link |
Thomas | i have a stringrid and want to show there my capacities of each Group.
This capacities (fieldname "cap" from datatype integer) i have in my table "gproups". In this table i have several Groups (fieldname "pgroup" from datatype string). my delphi-code is now. procedure Tlinhainfo.Button1Click(Sender: TObject); begin DBISAMQuery13.sql.Clear; dbisamquery13.SQL.Add('select cap from pgroups where pgroup = ''1'''); dbisamquery13.ExecSQL; StringGrid1.Cells[1,3] := inttostr(dbisamquery13.Fieldbyname('cap').AsInteger); DBISAMQuery13.sql.Clear; dbisamquery13.SQL.Add('select cap from pgroups where pgroup = ''2'''); dbisamquery13.ExecSQL; StringGrid1.Cells[2,3] := inttostr(dbisamquery13.fieldbyname('cap').AsInteger); DBISAMQuery13.sql.Clear; and so on... My question: Can i call directly my capacities from my table to show in my grid, for example to run the query only one time: DBISAMQuery13.sql.Clear; dbisamquery13.SQL.Add('select * from pgroups'); dbisamquery13.ExecSQL; then something to call each value directly: StringGrid1.Cells[1,3] := inttostr(dbisamquery13. and here something like [1,3] what means the value from column (fieldname) 1 and column (fieldname) 3 from my table what i want, not to run always the query, only one time |
Tue, Jan 2 2007 8:21 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Thomas
Try this untested code DBISAMQuery13.sql.Clear; dbisamquery13.SQL.Add('select * from pgroups'); dbisamquery13.ExecSQL; dbisamquery13.First; while not dbisamquery13.eof do begin StringGrid1.Cells[dbisamquery13.fieldbyname('pggroup').AsInteger,3] := inttostr(dbisamquery13.fieldbyname('cap').AsInteger); dbisamquery13.Next; end; But why not do the same with a table component? Roy Lambert |
This web page was last updated on Saturday, May 4, 2024 at 09:18 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |