terça-feira, 29 de setembro de 2009

Permite que seu db ignore os indices e recrie-os

Function CriaIndiceDB(TabName,Dataname,PIndice, PSIndice:string): Boolean;
Var
Tabela: TTable;
begin
Try
Tabela := TTable.Create(nil);
with Tabela do
begin
DatabaseName := TabName;
Exclusive := true;
TableName := Dataname;
IndexDefs.Clear;
try
AddIndex(PIndice,PIndice, [ixPrimary]);
if PSIndice <> ' ' then
begin
AddIndex(PSIndice,PSIndice,[ixCaseInsensitive]);
end;
except
on EDatabaseError do
MessageDlg('Esta Tabela está em uso!',mterror, [mbok],0);
end;
Close;
Exclusive := False;
end;
Result := True;
Except
Result := false;
end;
end;

Nenhum comentário:

Postar um comentário