Board index » delphi » Any clues on 'Key Violation' error?

Any clues on 'Key Violation' error?

I have checked all the tables involved, in case I am leaving one of the
index fields blank. I don't seem to be, but I keep getting the 'Key
Violation' error. (Delphi 3.0 with Paradox tables BDE v4.0)

Is there anything else common that can cause this error?

 

Re:Any clues on 'Key Violation' error?


This error doesn't mean that the keyt fields are blank, it means you are
trying to insert a record that has a duplicate index key. Check that the
values of the fields being added to the table don't already exist in the
file. This may also occur on secondary indexes that are unique.

Jose Ostos

Quote
Don Green wrote:
> I have checked all the tables involved, in case I am leaving one of the
> index fields blank. I don't seem to be, but I keep getting the 'Key
> Violation' error. (Delphi 3.0 with Paradox tables BDE v4.0)

> Is there anything else common that can cause this error?

Re:Any clues on 'Key Violation' error?


Here's a wierd circumstance that can also give
you a key violation.

Depending on your code,
actually, default behavior can give this error too.
For example, suppose you have code that
posts something onexit of a dbedit.  If you happen
to be doing subforming and a dbnavigator is on
the parent form and you do a next, depending
on your code, going to the parent form to hit the
dbnavigato could trigger a post from the onexit, and then the dbNavigator
also tries to post and for some reason gives a key violation.
I know it is a convoluted example but in case something
like that is happening in your code....

So basically, what I'm saying is that default behavior of
the dbnavigator can trigger your code  and give you a key violation.

Quote
Don Green <dgr...@ERICO.com> wrote in message

news:7nlo03$6ha2@forums.borland.com...
Quote
> I have checked all the tables involved, in case I am leaving one of the
> index fields blank. I don't seem to be, but I keep getting the 'Key
> Violation' error. (Delphi 3.0 with Paradox tables BDE v4.0)

> Is there anything else common that can cause this error?

Other Threads