ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 12th, 2005, 09:00 AM
mwoolgar mwoolgar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 25 mwoolgar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 16 m
Reputation Power: 0
problem inserting record

Hi

I'm having problems with this insert page. This coldfusion page is something I have inherited so it's a technology I know very little.

The page was working in access before I put the table into an sql server database. Since then it has not been working.

I think it has an issue with inserting the ID.

I have enclosed both pages.

Many thanks in advance

M

The error is:

ODBC Error Code = 23000 (Integrity constraint violation)
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert the value NULL into column 'ID', table 'New_News.dbo.pressreleases'; column does not allow nulls. INSERT fails.
The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (107:1) to (107:112).
Attached Files
File Type: doc Error Diagnostic Information.doc (86.5 KB, 1840 views)

Reply With Quote
  #2  
Old July 12th, 2005, 09:53 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 42 m 54 sec
Reputation Power: 53
The error says it all...you're trying to insert a NULL value into the ID column, but the ID column does not allow nulls. You must supply a valid value for the ID column.

Edit: after looking at the code you attached, my advice is to write a standard CFQUERY tag to do the insert. That is some of the worst, most complicated CFML code I have ever seen. Feel proud that you didn't write it.

Let me put it this way, it will take you way less time to learn how to write a cfquery tag and redo this page than it will to try and figure out what the hell it is doing. Probably not the answer you were hoping for but that's just reality.

Another edit: Actually you might be able to get out of this one by making the ID column an autonumber field...if you go into the table design in SQL Server, you can set the field to be an autonumber which means it will automatically populate that column with an incrementing number. I bet the old Access table was also using an autonumber. I think that might fix this particular issue but I still strongly advise you to refactor this page if you can...that code is horriffic.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Last edited by kiteless : July 12th, 2005 at 10:01 AM.

Reply With Quote
  #3  
Old July 12th, 2005, 10:06 AM
mwoolgar mwoolgar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 25 mwoolgar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 16 m
Reputation Power: 0
thank

Hmmm, thanks for the advise. I'll give the sql server work around a go - if that does not work I'll do this in .net. I'm not a fan of coldfusion.

Many thanks again.

M

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > problem inserting record


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT