Board index » delphi » secondary index bug with Paradox ?

secondary index bug with Paradox ?

Hi everybody,

in my application (D3), I use paradox tables. I have got a secondary index
which is supposed to be unique : I mean that if I try to add two record with
the same name,
it should fail.

It works OK. If I try to add an new record that already exists, I get an
error message
like 'KEY VIOLATION' .... That 's fine. If I do that two or three times, at
the end I can add the new record,
and then my index is out of order until I regenerate it with the Database
Module.

Does any one got some thing that looked like that ?

I hope my english was good enough to let you understand my problem !

Have a nice day

Fabrice

 

Re:secondary index bug with Paradox ?


I have no idea why Delphi/BDE allows you to put that erroneous code
after third trial. Of course it should not do so.
  To avoid this kind of situation, I usually have another TTable, connected
to the same DB file. Then I do FindKey using this TTable, to make validating,
for the first TTables secondary index field. That is, to check if user
given Code is acceptable or not. Works like a Buick.

procedure TEdPartsForm.PartsPartNoValidate(Sender: TField);
begin
  if PartsCheck.FindKey([PartsPartNo])
  then  raise Exception.Create('This code alredy exists.'
    +chr(10) +'Choose another code, or cancel edit by pressing ESC');

Markku Nevalainen

Quote
Fabrice Bardey wrote:

> Hi everybody,

> in my application (D3), I use paradox tables. I have got a secondary index
> which is supposed to be unique : I mean that if I try to add two record with
> the same name,
> it should fail.

> It works OK. If I try to add an new record that already exists, I get an
> error message
> like 'KEY VIOLATION' .... That 's fine. If I do that two or three times, at
> the end I can add the new record,
> and then my index is out of order until I regenerate it with the Database
> Module.

> Does any one got some thing that looked like that ?

> I hope my english was good enough to let you understand my problem !

> Have a nice day

> Fabrice

Re:secondary index bug with Paradox ?


In article <67e4q6$oc...@minus.oleane.net>, bar...@fifo.fr says...

Quote

>Hi everybody,

>in my application (D3), I use paradox tables. I have got a secondary index
>which is supposed to be unique : I mean that if I try to add two record
with
>the same name,
>it should fail.

>It works OK. If I try to add an new record that already exists, I get an
>error message
>like 'KEY VIOLATION' .... That 's fine. If I do that two or three times, at
>the end I can add the new record,
>and then my index is out of order until I regenerate it with the Database
>Module.

>Does any one got some thing that looked like that ?

>I hope my english was good enough to let you understand my problem !

Hi

I had a similar problem, the posting was done when I closed the form. I use
the on close queryto close all tables.

Now I search for existing records via findKey this works fine.I handel the
duplicate record in stead Paradox.

Hope this Helps

marcel

Other Threads