1,
with ClientDataModule.tbl_emp do
begin
Close;
Where.Clear;
Where.AddValueGroup('JOB',['SALESMAN','ANALYST']);
Where.AddText(' AND EMPNO > 7600 ');
Memo1.Text := Where.Clause;
ShowMessage(Memo1.Text);
MaxRecords := 100;
Open;
end;
说明://一 复合条件
// Where.AddConditions(['CustomerID'],
// [cEqual],
// ['ALFKI'], opAnd);
//二 增加一段条件
// Where.AddText('CustomerID = ''ALFKI''');
//三 增加一个in条件 Where.AddValueGroup('CustomerID',['ALFKI']);
// OpenBraket 增加一个左括号,CloseBraket增加一个右括号
// Where.OpenBraket;
// Where.CloseBraket;
with ClientDataModule.tbl_emp do
begin
Close;
Where.Clear;
Where.AddConditions(['ENAME','JOB'],[cLike,cLike],[Edit1.Text, Edit2.Text],opAND);
Memo1.Text := Where.Clause;
MaxRecords := 100;
Open;
end;
http://www.cnblogs.com/colincode/archive/2010/12/21/1912810.html