5 Replies Latest reply on Feb 11, 2009 9:46 AM by CFmonger

    Inserting a record, not working. Please help

    CFmonger
      Hello;
      I am stumped. I am trying to get this code to insert a new record, but when it goes through the code, it loses the record and doesn't insert it to the db. What am I missing? I can't figure it out.

      My code:

      <cfif isDefined("Form.newEdit_OK")>

      <cfif isDefined("Form.RecordID")>
      here is my query if it is updating and existing record
      <cfelse>
      <cfquery datasource="#APPLICATION.dataSource#" dbtype="ODBC">
      INSERT INTO news
      (title, newsDate, htmlList)
      VALUES (<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.title#">,
      <cfqueryparam cfsqltype="cf_sql_date" value="#form.newsDate#">,
      <cfqueryparam cfsqltype="cf_sql_longvarchar" value="#form.body#">)
      </cfquery>
      <cflocation url="news_RecordView.cfm">
      </cfif>

      What did I miss? I can't figure it out.

      CFmonger