troubleshooting Question

Populating data grid

Avatar of Paul Brooks
Paul BrooksFlag for United Kingdom of Great Britain and Northern Ireland asked on
Delphi
2 Comments1 Solution210 ViewsLast Modified:
Morning all
I need to populate a data grid using 2 criteria. The code i am trying is giving me a few problems as i am trying to set the SQL query for the first criteria and the filter for the second. The filter is working fine but i am having trouble with the SQL. There must be a more elegant way of doing this. My code so far is

procedure TFrmsalessearch.Button1Click(Sender: TObject);
var
accno : string;

begin
        Application.createform(Tfrmcontsearch, frmcontsearch);
          accno :=cmbsalesacc.text;
          frmcontsearch.Sqlcontracts.Active:=false;
          frmcontsearch.Sqlcontracts.SQL.Clear;
          frmcontsearch.Sqlcontracts.SQL.add('select * from CONTRACT_INFO where CLIENT_CODE = '+cmbsalesacc.text);
          frmcontsearch.Sqlcontracts.Active:=true;
          frmcontsearch.SQLcontracts.Filter:='CONTRACT_COMPLETE=' + QuotedStr('N');
          frmcontsearch.SQLcontracts.Filtered:=true;
          Frmcontsearch.label1.Caption := accno;
          frmcontsearch.showmodal;

end;

Any ideas are most welcome

Best regards
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros