View Single Post
  #4 (permalink)  
Old 05-15-2008, 09:17 AM
glook glook is offline
Junior Member
 
Join Date: Oct 2007
Location: Berkshire, UK
Posts: 30
Awards Showcase
Beta Tester 
Total Awards: 1
Default

I'll try to explain (sorry about the delay - been busy with other things).

A column may be defined as either the PRIMARY KEY or as UNIQUE. This is usually done when you create the table, either by an SQL command from B4ppc or with an external utility.

This column will then not accept duplicate values. If you try to insert record where the column value already exist, an "error" message will be produced - something like "Abort due to constraint violation column field1 is not unique".

In my opinion, it is best to handle this event before the error occurs, by testing for the value before attempting any insert - as in the sample code. Your program can then take the appropriate action. This test could be done regardless of how the column is defined.

Hope that helps,
Geoff.
__________________
Geoffrey Looker
www.deeproot.co.uk
Reply With Quote