我是这样写的~你们看一下吧
procedure TForm1.N7Click(Sender: TObject);
var
s,m,n:string;
year,month,day:word;
i:integer;
begin
i:=DayOfTheWeek(now);
decodedate(now,year,month,day);
if (length(inttostr(month))=2)and(length(inttostr(day))=2) then
begin
m:=inttostr(year)+'-'+inttostr(month)+'-'+inttostr(day-i+1);
n:=inttostr(year)+'-'+inttostr(month)+'-'+inttostr(day-i+7);
end;
if (length(inttostr(month))=2)and(length(inttostr(day))=1) then
begin
m:=inttostr(year)+'-'+inttostr(month)+'-0'+inttostr(day-i+1);
n:=inttostr(year)+'-'+inttostr(month)+'-0'+inttostr(day-i+7);
end;
if (length(inttostr(month))=1)and(length(inttostr(day))=2) then
begin
m:=inttostr(year)+'-0'+inttostr(month)+'-'+inttostr(day-i+1);
n:=inttostr(year)+'-0'+inttostr(month)+'-'+inttostr(day-i+7);
end;
if (length(inttostr(month))=1)and(length(inttostr(day))=1) then
begin
m:=inttostr(year)+'-0'+inttostr(month)+'-0'+inttostr(day-i+1);
n:=inttostr(year)+'-0'+inttostr(month)+'-0'+inttostr(day-i+7);
end;
ADOQuery6.Active :=False;
s:='select * from Cz_Main where Date>=';
s:=s+m+' and Date<=';
s:=s+n;
ADOQuery6.SQL.Text :=s;
ADOQuery6.Active :=True;
end;