Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default semicolon requested

    Can someone help me on this. I'm trying to insert data into 2 tables using cf
    defined statements from the insert form wizard. When I run the code in IE it
    keeps insisting I need to add a semicolons. See errors below:


    Error Occurred While Processing Request
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
    Access Driver] Missing semicolon (;) at end of SQL statement.

    The error occurred in C:\CFusionMX\wwwroot\MyColdfusion\Untitled-insert.cfm:
    line 136
    Called from line 2
    Called from line 1
    Called from line 136
    Called from line 2
    Called from line 1

    134 : <cfelse>
    135 : NULL
    136 : </cfif>
    137 : )
    138 : </cfquery>




    --------------------------------------------------------------------------------

    SQL INSERT INTO tblCustomer (CustomerName, CustomerPhone, CustomerEmail,
    CustomerTypeID ) VALUES ( 'John Doe' , 'xx' , 'xx' , 1 ) INSERT INTO
    tblNTracking (CategoryID, ECID, DNID, NNumber, NED, PubID, RecID,
    OtherCustomerEntry, Description, Resolution, DateInitiated, DateResolved,
    Assignee, OpenClosedStatus, ICID, INTID, SubjectID, Library ) VALUES ( '4' ,
    '2' , '30' , 'xx' , 'xx' , '73' , '2' , 'xx' , 'xx' , 'xx' , '040805' , NULL ,
    NULL , Open , '6' , '695' , '93' , 'xx' )
    DATASOURCE TraDatabase
    VENDORERRORCODE -3516
    SQLSTATE 42000

    Please try the following:
    Check the ColdFusion documentation to verify that you are using the correct
    syntax.
    Search the Knowledge Base to find a solution to your problem.


    Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

    My Code is as follows:


    <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
    <cfquery datasource="TraDatabase">
    INSERT INTO tblCustomer (CustomerName, CustomerPhone, CustomerEmail,
    CustomerTypeID ) VALUES (
    <cfif IsDefined("FORM.CustomerName") AND #FORM.CustomerName# NEQ "">
    '#FORM.CustomerName#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.CustomerPhone") AND #FORM.CustomerPhone# NEQ "">
    '#FORM.CustomerPhone#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.CustomerEmail") AND #FORM.CustomerEmail# NEQ "">
    '#FORM.CustomerEmail#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.CustomerTypeID") AND #FORM.CustomerTypeID# NEQ "">
    #FORM.CustomerTypeID#
    <cfelse>
    NULL
    </cfif>
    )
    INSERT INTO tblNTracking (CategoryID, ECID, DNID, NNumber, NED, PubID,
    RecID, OtherCustomerEntry, Description, Resolution, DateInitiated,
    DateResolved, Assignee, OpenClosedStatus, ICID, INTID, SubjectID, Library )
    VALUES (
    <cfif IsDefined("FORM.CategoryID") AND #FORM.CategoryID# NEQ "">
    '#FORM.CategoryID#'
    <cfelse>
    NULL
    </cfif>
    ,
    <cfif IsDefined("FORM.ECID") AND #FORM.ECID# NEQ "">
    '#FORM.ECID#'
    <cfelse>
    NULL
    </cfif>
    ,
    < **Code continues**
    NULL
    </cfif>
    ,
    **Code continues**
    <cfif IsDefined("FORM.Library") AND #FORM.Library# NEQ "">
    '#FORM.Library#'
    <cfelse>
    NULL
    </cfif>
    )
    </cfquery>
    </cfif>

    :confused;

    helpster Guest

  2. Similar Questions and Discussions

    1. cfgrid and semicolon bug
      This problem was posted way back in 2005 but I have not seen a solution to it. When querying from a database a record that contains a semicolon and...
    2. Missing semicolon problem
      I am getting the error of Missing semicolon at end of SQL statement on the LAST insert of the following code, but I don't know why. <cfquery...
    3. What does a semicolon do at the beginning of a line?
      Was browsing the documentation on reading a configuration file and found this. What does a semicolon do at the beginning of a line? ; <?php DO...
    4. behavior of semicolon on return line
      Does the semicolon behave any differently for a return test statement? Example, sub validate { return shift =~ /^*\.+$/ } or sub validate
    5. how to output semicolon with php
      hi! thanx for reading! my problem: I want to print : 7] Xerox: print '<a href='. '"javascript:;"'. "onClick='hideAll(); showHideLayers...
  3. #2

    Default Re: semicolon requested

    You may need to put a semicolon between your insert statements, but more
    likely, you will have to put each insert statement into its own CFQUERY. Some
    databases and connections will allow multiple queries with a single CFQUERY,
    but most do not.

    Phil

    paross1 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139