Re: Preventing Duplicate Records in Delphi


[ DelphiLand FAQ ] [ Delphi Tutorials ]

Posted by WAllison on December 01, 2001 at 19:28:01:

In Reply to: Re: Preventing Duplicate Records in Delphi posted by WAllison on December 01, 2001 at 19:20:23:

: : Is there a way to prevent duplicate records in Delphi while using tables? Thanks for your help :)

: TTable

: function FindKey(const KeyValues: array of const): Boolean; (success = true)

Use this to check whether or not the key(s) already exist. Obviously if it does then its gonna be a duplicate record (do this before post).

Out of interest TDataset generates exception EKeyViolation when theres a duplicate key.


[ DelphiLand FAQ ] [ Delphi Tutorials ]