BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Key violation

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop)
View previous topic :: View next topic  
Author Message
danny
Guest





PostPosted: Mon Dec 08, 2003 10:05 am    Post subject: Key violation Reply with quote



Hello...

My application has a dBase Table, and there is a index file to that dBase
table, the indexoptions is set to
ixPrimary. The table is read/write quite frequency, my application runs for
some time, and the application crashes some time, then I can't add record to
the dBase table because of Key Violation exception. What is the cause of the
key violation?? Does my application crash so that it make the table
corrupted?? How can I fix that table, is there any function calls to rebuild
the index file again??

Thank you.

Danny


Back to top
Dwayne
Guest





PostPosted: Mon Dec 08, 2003 11:27 pm    Post subject: Re: Key violation Reply with quote



Hello Danny,

Danny >>My application has a dBase Table, and there is a index file to that
dBase
table, the indexoptions is set to ixPrimary. The table is read/write quite
frequency, my application runs for
some time, and the application crashes some time, then I can't add record to
the dBase table because of Key Violation exception. What is the cause of the
key violation?? Does my application crash so that it make the table
corrupted?? How can I fix that table, is there any function calls to rebuild
the index file again??<<

There are a couple of things that can cause such.

1. Make sure your index allows for duplicate Keys.
2. Make sure you are writing a correct Key to the table when you do.
3. If you are running in a network, make sure the *new Record is saved
immediately so that another
person who is adding a record will not have the same record number.
(this is a cheapy way to get
around things. It works for most all cases, but not the best way to
solve network situations.)
4. Are you sure it is a Dbase file? not a Paradox? If paradox, you are
NOT allowed duplicate Keys on the primary. You will have to create a
secondary index or something.

What version of DBase are you using? There are ways to rebuild
your table and index. I can give you a program that does such... I think I
still have one in the archives.

Dwayne


Back to top
Dwayne
Guest





PostPosted: Tue Dec 09, 2003 5:02 pm    Post subject: Re: Key violation Reply with quote



Hello Jayme,

Jayme>>A database index which has the index options set to ixPrimary is a
primary key and primary keys do not allow duplicate values.<<

You are incorrect Jaymes. Maybe for a Paradox, but for some
versions of Dbase files, you are wrong. If you notice on the #4, I
explicitely said primary keys are not allowed on Paradox, because what he
was describing was more of a Paradox. Since he did not say which Dbase he
was using, I tried to cover Paradox and Dbase both.


Back to top
Jayme Jeffman Filho
Guest





PostPosted: Wed Dec 10, 2003 11:12 am    Post subject: Re: Key violation Reply with quote

Hello,

A database index which has the index options set to ixPrimary is a primary key and primary keys do not allow duplicate values.

HTH

Jayme.

"Dwayne" <myfrienddr (AT) yahoo (DOT) com> wrote

Quote:
Hello Danny,

Danny >>My application has a dBase Table, and there is a index file to that
dBase
table, the indexoptions is set to ixPrimary. The table is read/write quite
frequency, my application runs for
some time, and the application crashes some time, then I can't add record to
the dBase table because of Key Violation exception. What is the cause of the
key violation?? Does my application crash so that it make the table
corrupted?? How can I fix that table, is there any function calls to rebuild
the index file again??

There are a couple of things that can cause such.

1. Make sure your index allows for duplicate Keys.
2. Make sure you are writing a correct Key to the table when you do.
3. If you are running in a network, make sure the *new Record is saved
immediately so that another
person who is adding a record will not have the same record number.
(this is a cheapy way to get
around things. It works for most all cases, but not the best way to
solve network situations.)
4. Are you sure it is a Dbase file? not a Paradox? If paradox, you are
NOT allowed duplicate Keys on the primary. You will have to create a
secondary index or something.

What version of DBase are you using? There are ways to rebuild
your table and index. I can give you a program that does such... I think I
still have one in the archives.

Dwayne




Back to top
danny
Guest





PostPosted: Thu Dec 11, 2003 6:20 am    Post subject: Re: Key violation Reply with quote

Thanks for advice...

In fact, my dBase file is of level 7

Danny

"Dwayne" <myfrienddr (AT) yahoo (DOT) com> wrote

Quote:
Hello Jayme,

Jayme>>A database index which has the index options set to ixPrimary is a
primary key and primary keys do not allow duplicate values.

You are incorrect Jaymes. Maybe for a Paradox, but for some
versions of Dbase files, you are wrong. If you notice on the #4, I
explicitely said primary keys are not allowed on Paradox, because what he
was describing was more of a Paradox. Since he did not say which Dbase
he
was using, I tried to cover Paradox and Dbase both.





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.