Paradox Key Violation - changing a keyed field 
Author Message
 Paradox Key Violation - changing a keyed field

I have a delphi app that needs to be able to change a key field. When
I use the DBEdit component I get a "key violation" when the value is
changed and I try to Post.

The table is a driver for every other table in the app so using the
"+" increment field is not practical.

Is there a solution to this problem?



Wed, 18 Jun 1902 08:00:00 GMT  
 Paradox Key Violation - changing a keyed field

You shouldn't be getting a key violation unless you are trying to enter a
value that already exists in the table. You didn't mention when you get the
key violation (i.e., what actions you are doing that lead up to it). Just
"using" the DBEdit does not cause a key violation.
--
Mark Bratcher



Quote:
> I have a Delphi app that needs to be able to change a key field. When
> I use the DBEdit component I get a "key violation" when the value is
> changed and I try to Post.

> The table is a driver for every other table in the app so using the
> "+" increment field is not practical.

> Is there a solution to this problem?



Wed, 18 Jun 1902 08:00:00 GMT  
 Paradox Key Violation - changing a keyed field

You shouldn't be getting a key violation unless you are trying to enter a
value that already exists in the table. You didn't mention when you get the
key violation (i.e., what actions you are doing that lead up to it). Just
"using" the DBEdit does not cause a key violation.
--
Mark Bratcher



Quote:
> I have a Delphi app that needs to be able to change a key field. When
> I use the DBEdit component I get a "key violation" when the value is
> changed and I try to Post.

> The table is a driver for every other table in the app so using the
> "+" increment field is not practical.

> Is there a solution to this problem?



Wed, 18 Jun 1902 08:00:00 GMT  
 Paradox Key Violation - changing a keyed field



Quote:
>I have a Delphi app that needs to be able to change a key field. When
>I use the DBEdit component I get a "key violation" when the value is
>changed and I try to Post.

What version of Paradox tables?

Any referential integrity set?  If so, set it to Cascade.  Paradox
referential integrity has two modes, one that cascades the key-changes
down to child tables, and one that just prevents you from changing the
parent key, if it would create orphan child records.

If no referential integrity, there is nothing special your code needs
to do,  You will get the Key violation exception if you change the key
to a value already in the table.  That is the only reason you should
get the exception.  To "catch" the key violation error and display
your own error message, use a Try/Except around the POST.

Chuck Gadd
Director of Software Development, {*filter*} FX Communications.

Remove the -NOSPAM from my email address to send me e-mail.
*** I boycott businesses that send me unsolicited email adverti{*filter*}ts ***



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Paradox Autoincrement Fields Cause Key Violation -- Help!

2. Preventing Key Violation for duplicate keys

3. Q:Paradox Key Violations

4. Jet AutoNumber fields and Key Violations

5. Key violation in paradox

6. Key violation in paradox table

7. KEY VIOLATION on AUTOINCREMENT field ?!?

8. D2 - Paradox 7 - BDE 4.51 - Key Violation

9. Key Violations using Paradox Tables

10. Key Violation error with Paradox

11. Help: Paradox and Key Violations

12. V2 - Syntax to capture key violation on Paradox

 

 
Powered by phpBB® Forum Software