Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Index out of date problem

138 views
Skip to first unread message

Plamen Krastev

unread,
Apr 22, 1999, 3:00:00 AM4/22/99
to
Hi,
Here is the explanation of the problem:

I have dataset (Paradox table), where I defined secondary index which is
unique. In order to prevent user from entering duplicate values I wrote
OnPostError event handler where I check the error condition and if there
is Key violation (Error Code 9729 decimal) I inform the user in dialog
box about the error and set variable Action := daAbort. After that I
received BDE error "Index out of date".

I thought that if exception is raised the wrong action is not performed
so that error could not happen.

Where I am wrong? What is workaround in such a situation?

Another question: If index is "out of date" how to make it to be "in
date" ?

Thanx in advance.

Aaron Williamson

unread,
Apr 22, 1999, 3:00:00 AM4/22/99
to
Make sure your secondary index is "maintained".

Plamen Krastev <ra...@elits.rousse.bg> wrote in message
news:371F5081...@elits.rousse.bg...

Plamen Krastev

unread,
Apr 22, 1999, 3:00:00 AM4/22/99
to
Thank you Aaron,

I cannot remember was it "maintained", because I recreated it first
erasing it with the help of Database desktop and creating it again.

That index was created with Database desktop, and now I tried to create
one which is unique but not maintained and Database desktop denied such
operation, so the reason is not there.

Very strange is the fact that I have tried to reach that error condition
again for an hour and it didn't happen. I will continue testing.

Again to the second question: How to rebuild index which is "out of
date" programatically? Is the only possible way first to destroy it,
remove records with duplicated index values and create it again ?

Thanx for any suggestions.

Aaron Williamson

unread,
Apr 22, 1999, 3:00:00 AM4/22/99
to
> Again to the second question: How to rebuild index which is "out of
> date" programatically? Is the only possible way first to destroy it,
> remove records with duplicated index values and create it again ?
>
> Thanx for any suggestions.

Use the "AddIndex" and the "DeleteIndex" method for the TTable component.
Lookup in the delphi help file for the details on how to use them

,Aaron

Brian Bushay TeamB

unread,
Apr 23, 1999, 3:00:00 AM4/23/99
to
>I have dataset (Paradox table), where I defined secondary index which is
>unique. In order to prevent user from entering duplicate values I wrote
>OnPostError event handler where I check the error condition and if there
>is Key violation (Error Code 9729 decimal) I inform the user in dialog
>box about the error and set variable Action := daAbort. After that I
>received BDE error "Index out of date".
>
>I thought that if exception is raised the wrong action is not performed
>so that error could not happen.
That is the way it should work. I have had another user describe a similar
problem but I could not recreate it What version of Delphi and BDE are you
using?
Have you tried to Clear the field before the Abort?

>Another question: If index is "out of date" how to make it to be "in
>date" ?

Delete the index and recreate it.


--
Brian Bushay (TeamB)
Bbu...@NMPLS.com

Plamen Krastev

unread,
Apr 23, 1999, 3:00:00 AM4/23/99
to
I am working with Delphi Professional Version 3.01 and BDE 4.01.

No I haven't tried to clear the field before abort.

Actualy the code of event handler is short:

procedure TNomForm.NomenklPostError(DataSet: TDataSet; E:
EDatabaseError;
var Action: TDataAction);
var
ErrObject: TDBError;
begin
ErrObject := (E as EDBEngineError).Errors[0];
if ErrObject.ErrorCode = 9732 then MessageDlg('All fields must have
value',mtError,[mbOK],0)
else if ErrObject.ErrorCode = 9729 then MessageDlg('Field Code must
be unique',mtError,[mbOK],0)
else ShowMessage('ErrCode ' + IntToStr(ErrObject.ErrorCode));
Action := daAbort;
end;

After that "Index out of date" error I tried to recreate the problem
too, but I could not.
I will continue testing.

0 new messages