0

For some strange reason this simple INSERT statement in my CFQUERY tag just halts the page load. I have plenty of SELECT statements around my site, but the results on screen output the "Before SQL" dump and then end.

It must be something simple that I am missing. I have even used the hard-coded values below to test the statement before adding the dynamic CFPQUERYPARAM from the submitted FORM values. The datasource is declare for application in application.cfc

Thank you for the assist.

<cfdump var="Before SQL" abort="false" />

<cfquery name="insertResponses" result="insertResults">

    INSERT INTO StudentResponseTable
    VALUES
        (102, 1, 39, 1)

</cfquery>

<cfdump var="After SQL" abort="false" />

<cfdump var="insertResults" abort="true" />
  • 2
    wrap it in a try/catch block. The issue is probably you're not listing out your column names – Matt Busche Oct 08 '14 at 16:20
  • Anything in the application log on the server? I would stick it in a Try / Catch and log the error. Are there definitely only 4 columns in that table? – haxtbh Oct 08 '14 at 16:20
  • I've had the column names also, but I'll see what else I can glean from a try/catch – Byron Ferguson Oct 08 '14 at 16:20
  • 1
    Turn on de-bugging and see if the query shows up. Also, if have an onError function in your Application.cfc, comment it out so you can see the error message on your screen. – Dan Bracuk Oct 08 '14 at 16:22
  • 1
    Not related to your question, but your final cfdump needs octothorps around the variable name. – Dan Bracuk Oct 08 '14 at 16:24
  • 1
    I am newer to Coldfusion, and professional software, so I need to become more through with my programming (eg. try/catch, onError). The dumped results from the catch block showed the exact values I was submitting were being rejected as duplicate PK – Byron Ferguson Oct 08 '14 at 16:24
  • So I turst you can take it from here. – Dan Bracuk Oct 08 '14 at 16:36
  • Yep. I will try and use more try/catch blocks going forward. Thank you everyone. – Byron Ferguson Oct 08 '14 at 16:37
  • BTW, do not know if you saw DanBracuk's comment but - if this is a DEV environment, definitely turn on debugging and/or temporarily comment out any error handlers so you can actually *see* the errors as you work on the code :) – Leigh Oct 08 '14 at 19:11

1 Answers1

0

Based on the suggestions above I added a try/catch and learned from the 'catch' I was running into a duplicated PK on the SQL table.