设TheDate为日期型字段
Var
NowDate:TDateTime;
LastDate:TDateTime;
...
NowDate:=? //自己设定 strtodatetime('19999-5-7');
LastDate:=NowDate-30 //
Query.close;
Query.SQL:=' Select * from UTable
where (TheDate>:LastDate) and (TheDate<=:NowDate)'
Query.ParamByName('LastDate').AsDatetime:=LastDate;
Query.ParamByName('NowDate').AsDatetime:=NowDate;
Query.Open;
...
OK!