|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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). |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > problem inserting record |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|