?
Solved

Integrity constraint violation

Posted on 2003-02-22
2
Medium Priority
?
279 Views
Last Modified: 2013-12-24
When I test this page on my local machine, it works fine. After uploading (including the database) - I get the following error after trying to insert a new record:

-----------error message--------------
ODBC Error Code = 23000 (Integrity constraint violation)

[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'AddonID', table 'eldb.dbo.OrderAddons'; column does not allow nulls. INSERT fails.
-----------/error message--------------

I have the AddonID specified in a dropdown menu so it should not be passing a NULL value (and it doesn't on my local machine).

The only difference between my local machine & hosting company is that I'm using Coldfusion MX and they are using Coldfusion 4.5

Also, here is the code for the dropdown menu:

<cfquery name="Addons" datasource="eldb">
SELECT * FROM dbo.AvailableAddons
left join OrderAddons on OrderAddons.AddonID = AvailableAddons.AddonID
</cfquery>
-------------------
<select name="AddonID" class="formareasinput">
         <cfoutput query="Addons">
          <option value="#Addons.AddonID#">#Addons.AddonName#</option>
         </cfoutput>
        </select>


Any ideas?


0
Comment
Question by:tatortot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
JimV_ATL earned 160 total points
ID: 8001407
Would it be possible to see the insert sql statement on the form that processes the page?

Are you sure that you want to use a left join in your select statement?  The above statement will return null results for the fields in OrderAddons should the AddonID not exist in that table.  It would seem to me that an inner join is appropriate as you would not want a result where the id does not exist in both tables.

Good luck.

Jim

0
 

Author Comment

by:tatortot
ID: 8001778
Thank you, Jim!!

It was the "inner join" part that was messing things up. All I needed to do was change it to:

----
SELECT *
FROM AvailableAddons
---

Simple as that!

0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question