Sr.Sávio.

  Se puderes me ajudar ficareimuito grato.

  Paulo.


  O codigo encontre logo abaixo:



  unit Principal;

  interface

  uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    StdCtrls, Buttons, ExtCtrls, FileCtrl, Db, DBTables;

  type
    TForm1 = class(TForm)
      Panel1: TPanel;
      BitBtn1: TBitBtn;
      Tabela: TTable;
      FileListBox1: TFileListBox;
      DirectoryListBox1: TDirectoryListBox;
      Label1: TLabel;
      procedure BitBtn1Click(Sender: TObject);
    private
      { Private declarations }
    public
      { Public declarations }
    end;

  var
    Form1: TForm1;
    Temp1: Integer;
    Temp2: Integer;
    Temp3: Integer;
  Origem: String;
  implementation

  {$R *.DFM}

  procedure TForm1.BitBtn1Click(Sender: TObject);
  begin
  if Label1.Caption='Reestruturando Tabelas' then
  begin
    Temp3:=42;
    for Temp1:=1 to 2 do
    begin
     if Temp1=1 then
      begin
       Tabela.DatabaseName:='C:\Index\Principal';Criada estas duas pastas
       FileListBox1.Directory:='C:\Index\Arquivo Morto'; ???
       FileListBox1.Update;
      end else
       begin
        Tabela.DatabaseName:='C:\Index\Principal';
        FileListBox1.Directory:='C:\Index\Arquivo Morto';
        FileListBox1.Update;
       end;
     for Temp2:=0 to FileListBox1.Items.Count-1 do
      begin
       Origem:=UpperCase(FileListBox1.Items.Strings[Temp2]);
       if Copy(Origem,Length(Origem)-1,2)<>'DB' then
        DeleteFile(FileListBox1.Directory+'\'+Origem);
      end;
  //********** INÍCIO DA REESTRUTURAÇÃO **********//
     // Tabelas que serão indexadas
     Tabela.TableName:='IRMA.db';
     Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]);
     Tabela.AddIndex('PorNome','Nome',[ixCaseInsensitive]);
     Dec(Temp3);
     Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%';
     Update;
     //
     Tabela.TableName:='PATIVID.db';
     Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]);
     Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]);
     Tabela.AddIndex('PorValor','Valor',[ixCaseInsensitive]);
     Dec(Temp3);
     Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%';
     Update;
     //
     Tabela.TableName:='PCONTATO.db';
     Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]);
     Dec(Temp3);
     Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%';
     Update;
     //
     Tabela.TableName:='PDOENCA.db';
     Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]);
     Tabela.AddIndex('PorCodigo','Codigo',[ixCaseInsensitive]);
     Tabela.AddIndex('PorNome','Nome',[ixCaseInsensitive]);
     Dec(Temp3);
     Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%';
     Update;
     //
     Tabela.TableName:='PFAMILIA.db';
     Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]);
     Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]);
     Dec(Temp3);
     Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%';
     Update;
     //
     Tabela.TableName:='PFORMACAO.db';
     Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]);
     Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]);
     Dec(Temp3);
     Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%';
     Update;
     //
     Tabela.TableName:='PFUNCAO.db';
     Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]);
     Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]);
     Dec(Temp3);
     Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%';
     Update;
     //
     Tabela.TableName:='PHABILID.db';
     Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]);
     Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]);
     Dec(Temp3);
     Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%';
     Update;
     //
     Tabela.TableName:='PINSTRUC.db';
     Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]);
     Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]);
     Dec(Temp3);
     Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%';
     Update;
     //
     Tabela.TableName:='PITINERAR.db';
     Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]);
     Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]);
     Dec(Temp3);
     Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%';
     Update;
     //
     Tabela.TableName:='PLICENCA.db';
     Tabela.AddIndex('','Chave',[ixPrimary,ixUnique]);
     Tabela.AddIndex('PorData','Data',[ixCaseInsensitive]);
     Dec(Temp3);
     Label1.Caption:=FloatToStrF(100-(Temp3/42*100),ffNumber,3,0)+'%';
     Update;
    end;
    Sleep(1000);
  end;
  end;

  end.


  [As partes desta mensagem que não continham texto foram removidas]



  -- 
  <<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>

  Para ver as mensagens antigas, acesse:
  http://br.groups.yahoo.com/group/delphi-br/messages

  Para falar com o moderador, envie um e-mail para:
  [EMAIL PROTECTED] ou [EMAIL PROTECTED]




        Yahoo! Grupos, um serviço oferecido por: 
             
             
                      
             
       


------------------------------------------------------------------------------
  Links do Yahoo! Grupos

    a.. Para visitar o site do seu grupo na web, acesse:
    http://br.groups.yahoo.com/group/delphi-br/
      
    b.. Para sair deste grupo, envie um e-mail para:
    [EMAIL PROTECTED]
      
    c.. O uso que você faz do Yahoo! Grupos está sujeito aos Termos do Serviço 
do Yahoo!. 



[As partes desta mensagem que não continham texto foram removidas]



-- 
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>

Para ver as mensagens antigas, acesse:
 http://br.groups.yahoo.com/group/delphi-br/messages

Para falar com o moderador, envie um e-mail para:
 [EMAIL PROTECTED] ou [EMAIL PROTECTED]
 
Links do Yahoo! Grupos

<*> Para visitar o site do seu grupo na web, acesse:
    http://br.groups.yahoo.com/group/delphi-br/

<*> Para sair deste grupo, envie um e-mail para:
    [EMAIL PROTECTED]

<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
    http://br.yahoo.com/info/utos.html

 



Responder a