vanix
Mensagens : 26 Data de inscrição : 20/01/2011
| Assunto: como Re-indexar em tabela paradox (Resolvido) Qua Out 10, 2012 8:00 am | |
| Estou tentando reindexar tabelas paradox dentro do programa, mas recebo a mensagem OBJECT NOT LOCKED Fora do programa funciona normal, as vezes a mensagem O ARQUIVO JA ESTA SENDO UTILIZADO POR OUTRO PROCESSO - Código:
-
procedure TIndices.BitBtn1Click(Sender: TObject); var List: TStrings; I : Integer; table:ttable; c_alias:string; begin
dm1.table1.close; dm1.table2.close;
c_alias:=trim(edit1.text); List := TStringList.Create; Session.GetTableNames(c_alias,'', True, False, List);
for i := 0 to List.Count - 1 do begin Application.ProcessMessages; table500.databasename:=trim(edit1.text); if (Pos('.DBF',lIST[I])= 0) then begin Table500.close; table500.TableName := List[i]; TABLE500.EXCLUSIVE:=TRUE; Table500.open; Check(DbiRegenIndexes(table500.Handle)); end; END; end; agradeço qualquer sugestão...
Última edição por vanix em Dom Out 21, 2012 7:21 am, editado 1 vez(es) | |
|
volverine
Mensagens : 14 Data de inscrição : 28/01/2011
| Assunto: Re: como Re-indexar em tabela paradox (Resolvido) Sex Out 19, 2012 1:22 pm | |
| faça desta forma que não terá erro!. componentes: ListBox1 Edit1 ProgressBar1 BitBtn1 button1 - Código:
-
implementation Var FlagBreak : Boolean; FlagDoing : Boolean; - Código:
-
procedure Reindex(DataBase : TDataBase; Table : TTable; Edit : TEdit; ProgressBar : TProgressBar); Var List: TStrings; i : Integer; begin try Database.Connected := True; except raise; exit; end; List := TStringList.Create; Session.GetTableNames(Database.AliasName, '', True, False, List); for i := 0 to List.Count - 1 do begin if(FlagBreak) then Break; Edit.Text := List[i]; ProgressBar.Position := Trunc(100 * i / List.Count); Application.ProcessMessages; Table.Close; Table.TableName := List[i]; try Table.Open; Check(DbiRegenIndexes(Table.Handle)); except raise; end; end;
List.Free; Database.Connected := False; ProgressBar.Position := 0; Edit.Text := ''; end; - Código:
-
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject); begin Session.GetAliasNames(ListBox1.Items); if(ListBox1.Items.Count > 0) then ListBox1.ItemIndex := 0; end; - Código:
-
procedure TForm1.Button1Click(Sender: TObject); begin if(FlagDoing) then FlagBreak := True else if(ListBox1.ItemIndex <> -1) then begin FlagDoing := True; Database1.AliasName := ListBox1.Items[ListBox1.ItemIndex]; ListBox1.Enabled := False; BitBtn1.Enabled := False; FlagBreak := False; Button1.Caption := 'Cancel'; reindex(DataBase1, Table1, Edit1, ProgressBar1); Button1.Caption := 'Start'; ListBox1.Enabled := True; BitBtn1.Enabled := True; FlagDoing := False; end;
end; e é isto para reindexar tabela paradox, at+ | |
|