 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
danny Guest
|
Posted: Mon Dec 08, 2003 10:05 am Post subject: Key violation |
|
|
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
|
Posted: Mon Dec 08, 2003 11:27 pm Post subject: Re: Key violation |
|
|
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
|
Posted: Tue Dec 09, 2003 5:02 pm Post subject: Re: Key violation |
|
|
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
|
Posted: Wed Dec 10, 2003 11:12 am Post subject: Re: Key violation |
|
|
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
|
Posted: Thu Dec 11, 2003 6:20 am Post subject: Re: Key violation |
|
|
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 |
|
 |
|
|
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
|
|