Cannot update [tablename].  The data you entered conflicts...

Problem

You see this error when attempting to save data in your application:

Microsoft Internet Explorer

Cannot update name:

The data you entered conflicts with a database constraint:  INSERT statement conflicted with COLUMN FOREIGH KEY constraint ‘XXX’.  The conflict occurred in database ‘YYY’, table ‘ZZZ’, column ‘AAA’.

The statement has been terminated.  Please consult your database administrator for more information.

The table has a default value for the primary key field that conflicts with the foreign key constraint on the field.  This interferes with the application when it attempts to insert a new record into the database.

Description

The stored procedure created by Iron Speed Designer relies on default values to be valid.  The stored procedure inserts a record into the table with default values (for columns with default values) and supplied values (for columns without default values).  This is immediately followed by updating columns with default values to take the supplied values.  If the insertion fails due to an invalid default value, the Add record operation will fail.  For example, suppose you have an Orders.CustomerID field with a foreign key relationship to the Customers.CustomerID field.  Further suppose there is no Customer.CustomerID of 0.  If your Orders.CustomerID field has a default value of 0, you will get this error.

Solution

Either remove the default value in the database, or change the default value to a valid value for that field.

See Also

Part VII:  Troubleshooting Applications

Application Will Not Run

Application Runs But No Data is Displayed

Application Error Messages