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

#@! Key violation error !!!!!!!!!!!! Arrrgh

309 views
Skip to first unread message

Guy Goossens

unread,
Apr 29, 1999, 3:00:00 AM4/29/99
to
I have some tables with the primary key set to an autoincrement field. I
get sometimes (when i append record) a "key violation" error. This error is
a non-sense because autoincrement integer must be off course unique. Pack
the table solve the problem. Someone say : this is a bug in BDE <=4.51 and
i think that's true.

Is it true that the BDE version 5.01 solve this problem ?

Biets Freddy

unread,
Apr 29, 1999, 3:00:00 AM4/29/99
to
if this is multi-user than you have to search for something else than
auto-incremental keys.
They do not work properly in a multi-user environment.

Freddy Biets
h...@village.uunet.be


Guy Goossens heeft geschreven in bericht <7g9kfj$o5...@forums.borland.com>...

Trey Thrasher

unread,
Apr 29, 1999, 3:00:00 AM4/29/99
to
As best as I can determine, the next value for auto increment field is
stored in the table header. Under certain circumstances, the header is not
updated correctly. When that happens, the next time someone attempts to
insert a new record, a duplicate value will be entered causing a key
violation. When that happens, the only way that I have found to remedy the
problem it is to restructure the table changing the auto increment field to
a long integer and then restructure the table again changing the long
integer back to an auto increment field. Because of the problems using auto
increment fields, I have stopped using them as key values.

Guy Goossens <guy.go...@bjl.be> wrote in message
news:7g9kfj$o5...@forums.borland.com...

Mike Orriss (TeamB)

unread,
Apr 29, 1999, 3:00:00 AM4/29/99
to
In article <7g9kfj$o5...@forums.borland.com>, Guy Goossens wrote:
> I have some tables with the primary key set to an autoincrement field. I
> get sometimes (when i append record) a "key violation" error.
>

I assume that you have created persistent TFields. When I've had this error
in the past, I've cured the problem by setting the autoinc field to read
only.

Mike Orriss (TeamB)
(No e-mail replies, please, unless explicitly requested!)


Chris Wallace

unread,
Apr 29, 1999, 3:00:00 AM4/29/99
to
I got around the problem by locking the table prior
to creating new records and unlocking it after the
post. Yes, it does slow things down a bit because
the BDE has to go out and diddle with the pdoxusrs.lck
file, but it's worth the performance hit -- it effectively
eliminates the corrupt auto-inc keys.

Guy Goossens <guy.go...@bjl.be> wrote in message
news:7g9kfj$o5...@forums.borland.com...

> I have some tables with the primary key set to an autoincrement field. I

Brian Bushay TeamB

unread,
Apr 30, 1999, 3:00:00 AM4/30/99
to

>I have some tables with the primary key set to an autoincrement field. I
>get sometimes (when i append record) a "key violation" error. This error is
>a non-sense because autoincrement integer must be off course unique. Pack
>the table solve the problem. Someone say : this is a bug in BDE <=4.51 and
>i think that's true.

Autoincrement keys are not as robust as normal fields. The last increment value
used is stored in the table header. If there is any error on updating the table
the next value stored in the table header might not get updated. The result
will be that the value is reused on the next insert and a key violation.


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

Guy Goossens

unread,
Apr 30, 1999, 3:00:00 AM4/30/99
to
>if this is multi-user than you have to search for something else than
>auto-incremental keys.
>They do not work properly in a multi-user environment.


Hello,

Yes it is multi-user, i meen the paradox database is installed on NT server
in a shared directory and multiples computers are connected to this
directory and they access the database over the network.

What do you meen by "something else" ? Do you meen i must generated the
numbers by code ? If so how can i do if i want the user be able to add
record in a DBGrid ? I feel this give me a lot of work, i have multiples
tables using autoinc. field :-(

Thanks for your attention.


Guy Goossens

unread,
Apr 30, 1999, 3:00:00 AM4/30/99
to
>I assume that you have created persistent TFields. When I've had this error
>in the past, I've cured the problem by setting the autoinc field to read
>only.
>

Hello,

What's "persistent TFields" ? Do you meen : setting the ReadOnly property
for the field in Delphi ?

I dit'n do this, it's too easy, i will try this.

Thanks for your attention.


Olivier

unread,
Apr 30, 1999, 3:00:00 AM4/30/99
to
Do not use Autoinc fields on network : that doesn't work !

--
Olivier Dahan
oda...@cybercable.fr
Delphi 32b C/S certified engineer
Biets Freddy <h...@village.uunet.be> a écrit dans le message :
7g9rhv$o6...@forums.borland.com...


> if this is multi-user than you have to search for something else than
> auto-incremental keys.
> They do not work properly in a multi-user environment.
>

> Freddy Biets
> h...@village.uunet.be
>
>
> Guy Goossens heeft geschreven in bericht
<7g9kfj$o5...@forums.borland.com>...

> >I have some tables with the primary key set to an autoincrement field. I
> >get sometimes (when i append record) a "key violation" error. This error
is
> >a non-sense because autoincrement integer must be off course unique. Pack
> >the table solve the problem. Someone say : this is a bug in BDE <=4.51
and
> >i think that's true.
> >

Mike Orriss (TeamB)

unread,
Apr 30, 1999, 3:00:00 AM4/30/99
to
In article <7gbr6j$pt...@forums.borland.com>, Guy Goossens wrote:
> Do you meen : setting the ReadOnly property
> for the field in Delphi ?
>

Yes

0 new messages