#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    7
    Rep Power
    0

    Cfupdate Cfinsert


    I am having problems using <CFUPDATE> with the following update/insert. The problem is that I can't use the where= in the CFUPDATE tag as I do in the regular SQL (see below). Is there a way to do this with CFINSERT and CFUPDATE Here is my code.

    I need it to work with CF tags because of date field issues. ANY suggestions are appriciated.

    -------------------------------------------------
    <CFQUERY NAME="checkval" DATASOURCE="cisdata">
    SELECT a.ID, b.ameriapp_id
    FROM ameriadmin b RIGHT OUTER JOIN
    ameriapp a ON a.ID = b.ameriapp_id
    WHERE a.ID = #listing__ID#
    </CFQUERY>

    <cfoutput query="checkval">

    <cfif ameriapp_id NEQ ID>


    <cfquery datasource="cisdata">
    insert into ameriadmin
    ( ameriapp_id,notes,whatnextnotice)
    values (#ID#,'#notes#','#whatnextnotice#' )
    </cfquery>
    <cfelse>


    <cfquery datasource="cisdata">
    update ameriadmin
    set notes='#notes#',
    whatnextnotice='#whatnextnotice#',
    WHERE ameriapp_id = #listing__ID#
    </cfquery>



    </cfif>
    </cfoutput>
    ------------------------------------

    THANKS
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,281
    Rep Power
    968
    CFINSERT and CFUPDATE are two CFML tags that should never have been made. They were trying to make it "easy" for non-programmers but all the really did was create more confusion. Just use CFQUERY and write your own INSERT or UPDATE statements.

IMN logo majestic logo threadwatch logo seochat tools logo