We help IT Professionals succeed at work.

Index Corrupted (Paradox)

Dumani
Dumani asked
on
One of my programs sometimes gives me corrupted index. I am using Paradox. I couldn't find where this error happens. What causes this problem ? I need an urgent reply. I know how to fix corrupted index. I don't know how to avoid this error?

Regards,
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2004
Commented:
this error occurs if your app abnormal abords during a writing access to a table

or

by not properly configured bde in a multiuser-enviroment

drop all indexes and recreate

meikl ;-)

CERTIFIED EXPERT
Top Expert 2004

Commented:
a sample for dropping and recreating indexes

unit re_index_u;

interface

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

type
  TForm1 = class(TForm)
    Table1: TTable;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

Function ReIndexTable(ATable : TTable) : Boolean;
var
  I : Integer;
  T : TTable;
  OldExclusive : Boolean;
  OldActive : Boolean;
  OldIndexFieldNames : String;
  OldIndexName : String;
begin
  Result := True;
  T.Create(Nil);
  OldActive := ATable.Active;  //Remember Changed Propertys
  OldExclusive := ATable.Exclusive;
  OldIndexFieldNames := ATable.IndexFieldNames;
  OldIndexName := ATable.IndexName;
  try
    ATable.IndexDefs.Update;   //Retrieve indexes
    T.IndexDefs.Assign(ATable.IndexDefs);  //a copy
    ATable.Close;              //Prepare
    ATable.Exclusive := True;
    ATable.IndexFieldNames := '';
    ATable.IndexName := '';
    ATable.Open;
    try
      For I := ATable.IndexDefs.Count - 1 downto 0 do //highest first
        ATable.DeleteIndex(ATable.IndexDefs.Items[I].Name); //Drop indexes
      For I := 0 to ATable.IndexDefs.Count - 1 do //highest first
        ATable.AddIndex(T.IndexDefs.Items[I].Name,
                        T.IndexDefs.Items[I].Fields,
                        T.IndexDefs.Items[I].Options,
                        T.IndexDefs.Items[I].DescFields); //Add indexes
    except
      Result := False;
      Raise;
    end;
  finally
    try
      T.Free;
      ATable.Exclusive := OldExclusive;  //Set Back
      ATable.IndexFieldNames := OldIndexFieldNames;
      ATable.IndexName := OldIndexName;
      ATable.Active :=OldActive;
    except
      Result := False;
      Raise;
    end;
  end;
end;

//usage sample
procedure TForm1.Button1Click(Sender: TObject);
begin
  if ReIndexTable(Table1) then
    Showmessage('Table is ReIndexed')
  else
    Showmessage('There was an error!');
end;

end.


meikl ;-)

Commented:
Listening...
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if they are still open in 14 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.11422898.html
http://www.experts-exchange.com/questions/Q.20145825.html
http://www.experts-exchange.com/questions/Q.20185852.html
http://www.experts-exchange.com/questions/Q.20192580.html
http://www.experts-exchange.com/questions/Q.20193028.html
http://www.experts-exchange.com/questions/Q.20193236.html
http://www.experts-exchange.com/questions/Q.20211987.html
http://www.experts-exchange.com/questions/Q.20192579.html
http://www.experts-exchange.com/questions/Q.20294634.html



*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643 
POINTS FOR EXPERTS awaiting comments are listed in the link below
http://www.experts-exchange.com/commspt/Q.20277028.html
 
Moderators will finalize this question if in @14 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thanks everyone.
Moondancer
Moderator @ Experts Exchange
CERTIFIED EXPERT
Top Expert 2004

Commented:
>I need an urgent reply
seems to be not an urgent issue
Dumani:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
CERTIFIED EXPERT

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

accept kretzschmar's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

geobul
EE Cleanup Volunteer

Explore More ContentExplore courses, solutions, and other research materials related to this topic.