[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 138
  • Last Modified:

Filter using two text fields?

I need to be able to filter a table based on information taken from two edit.text boxes. How do I do this?
Cheers
Mike Ross
0
mykyl
Asked:
mykyl
1 Solution
 
333Commented:
Hi,
Use TQuery, not TTable.

i.e if Query1 is TQuery, then

procedure Form1.Button1Click(Sender:TObject);
begin
  if Query1.Active then Query1.Close;
  Query1.Sql.Clear;
  Query1.Sql.Add('select * from MyTable where Field1="'+Edit1.Text+'" and Field2="'+Edit2.Text+'"');
  Query1.Open;
end;

A.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now