源代码如下:
     FirstDay:='2002-11-11';
     CAdoquery:=TADOQuery.Create(nil);
     CAdoquery.ConnectionString:='provider=Microsoft.Jet.OLEDB.4.0;Data Source='+Path+'data\'+FirstDay+'.mdb;Persist Security Info=False';;
     CAdoquery.ParamCheck:=false;
     try
     CAdoquery.Close;
     CAdoquery.SQL.Text:='select File.Id,File.StartDate,File.FileName from ['+path+'data\'+FirstDay+'].File  order by File.StartDate';
      CAdoquery.Open;
      Gauge1.MaxValue:=CAdoquery.RecordCount+10;
      if CAdoquery.RecordCount>0 then
       begin
           CAdoquery.Recordset.MoveFirst;
           while (not (CAdoquery.Recordset.EOF or Cadoquery.Recordset.Bof)) do begin
           deletefile(path+'file\'+datetostr(CAdoquery.Recordset.Fields['StartDate'].Value)+'\'+CAdoquery.Recordset.Fields['Filename'].Value);
           Cadoquery.Recordset.MoveNext;
           CleanShowForm.Gauge1.Progress:=CleanShowForm.Gauge1.Progress+1;
            end;
        end;
           CAdoquery.Close;
           CAdoquery.Free;
           deletefile(path+'data\'+FirstDay+'.mdb');
           Gauge1.Progress:=Gauge1.Progress+10;
      except
            SaveLog(Datetimetostr(now)+' 自动清理录音文件时出现错误');
      end;
此代码执行完毕后数据库2002-11-11.mdb却没有被删除,不知为何?有劳大家看一下,谢谢了