Skip to main content
Participant
July 28, 2011
Question

Insert Error

  • July 28, 2011
  • 1 reply
  • 788 views

Hi

This code works in CF5, but delivers this error in CF8:

Error Executing Database Query.[Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert the value NULL into column 'last_modified', table 'edebt_international_com.dbo.DEBTORS'; column does not allow nulls

Here is the code:

<CFSET  Form.last_modified=CreateODBCDateTime(ParseDateTime(now()))>

<cfcatch type="Any">

<script language="Javascript">

alert('You have entered an incorrect date, please check your data.')

history.back()

</script>

<cfabort>

</cfcatch>

Any help would be appreciated.

Also If I change ODBC to JDBC, I get the next line 'you have entered an incorrect date...'

I am looking to enter todays date.

Thanks

    This topic has been closed for replies.

    1 reply

    Inspiring
    July 28, 2011

    The code you show us is not the code that is erroring.  Also, it's not a CF error, it's a DB error, so I'm not sure you're telling the full story in saying it works on CF5 but not CF8.

    Post the code that's actually erroring.  Also, check the SQL that's being passed to the DB rather than the CF code that creates the SQL: it's the SQL that's causing the problem.

    --

    Adam

    Participant
    July 28, 2011

    Not sure how to check the SQL, its a hosted CF8 & SQL2005 server.

    The only other difference is I run SQL2000, as opposed to SQL2005.

    Cant see where else the error is coming from....

    Inspiring
    July 28, 2011

    Both the SQL being sent to the DB and the exact line number (and a snippet of the erroring code) should be being displayed along with the error message.

    You perhaps don't have Robust Exception Handling switched on, which is essential when troubleshooting errors.  Is this a production server, or your development server?

    If you've changed your DB, you could well have changed your DB schema too (either on purpose of inadvertantly), and perhaps are no longer allowing nulls in that column.

    What's the table-create SQL for the table on the SQL Server 2000 server; and what's the same SQL on the new 2005 server?

    --

    Adam