At 02:04 AM 12/15/00 +0000, you wrote:
>I get this error when trying to insert to the Access database i have over at
>cfm-resources.com, the access DB is available to view here
>http://www.cfm-resources.com/b/bludhall/data/bludhall.mdb
>I'm using CF 4.5, i have no idea of the service pack versions, its the free
>hosting at cfm-resources.com
>
>------------------------------------------------
>Error Diagnostic Information
>ODBC Error Code = 23000 (Integrity constraint violation)
>
>
>[Microsoft][ODBC Microsoft Access Driver] The changes you requested to the
>table were not successful because they would create duplicate values in the
>index, primary key, or relationship. Change the data in the field or fields
>that contain duplicate data, remove the index, or redefine the index to
>permit duplicate entries and try again.
>
>
>
>The error occurred while processing an element with a general identifier of
>(CFQUERY), occupying document position (3:1) to (3:64).

The good news about CF error messages is that sometimes that are actually 
correct. You have a query on line three of this file. The query is 
inserting information to some table in the database. The table that 
information is being inserted to has a primary key. The primary key stores 
a value that must be unique for every record in the table, since this is a 
unique identifier for each record. You are trying to insert a record that 
has the same primary key value as an existing record and the database won't 
let you do it. It is possible that you are trying to test with duplicate 
data including a duplicate primary key, or perhaps you really want to 
update instead of insert. There are ways to generate a primary key value so 
you don't have this problem testing with otherwise duplicate data.

I recommend that you pick up a copy of "Sams Teach Yourself SQL in 10 
Minutes." This is really a SQL question and it is apparent that you need to 
get some foundation in database work. This book is small, straightforward, 
and cheap. I use it as a handy desk reference when I forget stuff but I'm 
sure that it will help you get enough of a foundation in databases that you 
will understand what error messages like these mean.

Good luck! If you need to know how to generate a primary key value, let us 
know. You might even get a faster response since that would be an on-topic 
question.

Oh, and in the future you should probably not point people directly to your 
database file, in case there are some mean nasties about. Slight security 
issue.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to