Cfqueryparam problem

While cleaning up some sql injection problems, I found I had
to rewrite how the inserts were working.
I do not know in advance what fields need to be populated for
inserts so I mad a generic function
to make my inserts.
<cffunction name="insertIntoTable" access="private"
returntype="void">
<cfargument name="table" type="string" required="yes">
<cfargument name="datasource" type="string"
required="yes">
<cfargument name="keyValSet" type="struct"
required="yes">
<cfset var keyList = structKeyList(keyValSet)>
<cfset var curKey = "">
<cfset var curVal = "">
<cfset var comma = "">
<cfset var insertIntoTable = "">
<cfquery datasource="#datasource#"
name="insertIntoTable">
insert into #table# (#keyList#)
values (<cfloop list="#keyList#"
index="curKey">#comma#<cfset comma = ","><cfset curVal
= trim(keyValSet[curKey])><cfif len(curVal) eq
0><cfqueryparam null="yes"><cfelse><cfqueryparam
value="#curVal#"></cfif></cfloop>)
</cfquery>
<cfreturn>
</cffunction>
I know before this call is made that the table names and the
keylist is clean.
I found that I could not simply use a <cfqueryparam
list="yes" ...> as some of
the entries may be null.
My current problem is when someone enters Joe's Crab Shack
into a form field
the corresponding data record results in Joe''s Crab Shack.
I found a hotfix for CF MX 6.1 with something that sounded
similar, however
we are running CF 7.02 on redhat. The db server is an old MS
SQL Server (8.00).

It appears that the two single quotes problem occurs only
when cfloop is used, which looks very similar to one of the
problems the hotfix for CF MX 6.1 had.
Has anyone else come across this problem?

Similar Messages

  • Problem with a query inner-join

    Hello;
    I'm trying to innerjoin these 2 tables in my query for a page that will allow you to add / edit records. Right now, it's telling me I have a data mismatch. I don't see where I went wrong. Can someone help me out?
    This is my code:
    <cfparam name="url.CategoryID" type="integer" default="0">
    <cfparam name="subID" type="integer" default="#url.CategoryID#">
    <cfparam name="subName" default="">
    <cfparam name="CategoryID" default="">
    <cfparam name="Name" default="">
    <cfif url.CategoryID GT 0>
    <cfquery name="categRec" dataSource="#APPLICATION.dataSource#">
    SELECT merchSubCat.subName, merchSubCat.subID, Categories.CategoryID, Categories.Name
    FROM merchSubCat
    INNER JOIN Categories
        ON merchSubCat.CategoryID = Categories.CategoryID
    WHERE merchSubCat.subID = <cfqueryparam value="#url.CategoryID#" cfsqltype="cf_sql_integer">
    </cfquery>
    <!--- if the record was found, store the values --->
    <cfif categRec.RecordCount EQ 1>
    <cfset CategoryID = categRec.subID>
    <cfset subName = categRec.subName>
    <cfset CategoryID = categRec.CategoryID>
    <cfset Name = categRec.Name>
    </cfif>
    </cfif>
    this is my error:
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Type mismatch in expression.
    The error occurred in C:\Websites\187914kg3\admin\cms\merchant\merchSub-edit.cfm: line 16
    14 : INNER JOIN Categories
    15 :     ON merchSubCat.CategoryID = Categories.CategoryID
    16 : WHERE merchSubCat.subID = <cfqueryparam value="#url.CategoryID#" cfsqltype="cf_sql_integer">
    17 : </cfquery>
    18 :
    I don't see what I did wrong, can another pair of eyes see where I missed something?
    Thank you

    I changed it to number, and it works now.
    I have one other problem.. I'm trying to use a drop down menu in this form to edit a record. I want the drop down to show what is being used in the database when you go to edit a record. It runs on one query, to populate the select, but it pulls info from another and this isn't working. Actually, it's the innerjoin I just made.. can you help me?
    <!--- query that runs the select --->
    <cfquery name="catList" datasource="#APPLICATION.dataSource#">
    SELECT DISTINCT merchCategory.CategoryID, merchCategory.CatName AS cat_name
    FROM merchCategory
    ORDER BY CatName
    </cfquery>
    <cfselect enabled="No" name="CategoryID" size="1" class="smallText" multiple="no" query="catList" value="CategoryID" display="cat_name" queryPosition="below" selected="#categRec.Name#">
                      <option value="">--Select a Category--</option>
                  </cfselect>
    As you see, in the selected part of the tag, I'm trying to pull info from the other query we just fixed. I know this is wrong, how do I do this?

  • Query problem again

    Will I ever get this!
    I have a form template which runs fine (it registers a user
    of my discussino board):
    <h2>Register here to post comments to any forum on this
    site </h2>
    <form action="Education - Bulletin Board - Register -
    code.cfm" method="post">
    <p>
    <strong>Username: </strong>
    <input type="text" name="user" />
    </p>
    <p><br />
    <strong>Password: </strong>
    <input type="password" name="pass" />
    </p>
    <p><br />
    <strong>Your mother's maiden name (a security
    precaution if you forget your username/password and need to
    retrieve them): </strong>
    <input type="text" name="MaidenName" />
    </p>
    <p><br />
    <strong>Email address (optional - in case I need to
    contact you about your posts): </strong>
    <input type="text" name="email" />
    </p>
    <p><br />
    <p>
    <input type="submit" value="Register!" />
    <input type="button" value="Back"
    onClick="self.location='index.cfm';" />
    </p>
    </form>
    </body>
    Now I want to check if the username and password have been
    taken by a previous user so I use this code:
    <cfif NOT structIsEmpty(form)>
    <cfquery name="CheckUserName" datasource= "Education
    Forum">
    SELECT UserName, Count(UserName) as Duplicates
    FROM ForumUsers
    WHERE ForumUsers.UserName=#form.user#
    GROUPBY ForumUsers.UserName
    </cfquery>
    <cfquery name="CheckPassword" datasource= "Education
    Forum">
    SELECT PassWord, Count(PassWord) as Duplicates
    FROM ForumUsers
    WHERE ForumUsers.Password=#form.PassWord#
    GROUPBY Password
    </cfquery>
    I just count how many times the password has been used. If it
    has been used more than once I'll later ask the new user to enter a
    different password. Unfortunately, Coldfusion has a problem with
    this query. Specifically, it gives me the error:
    Access Driver] Syntax error (missing operator) in query
    expression 'ForumUsers.UserName=jimmy GROUPBY ForumUsers.UserName'.
    The Error Occurred in C:\CFusionMX\wwwroot\Education\Bulletin
    Board\Education - Bulletin Board - Register - code.cfm: line 7
    5 : WHERE ForumUsers.UserName=#form.user#
    6 : GROUPBY ForumUsers.UserName
    7 : </cfquery>
    8 : <cfquery name="CheckPassword" datasource= "Education
    Forum">
    9 : SELECT PassWord, Count(PassWord) as Duplicates
    SQL SELECT UserName, Count(UserName) as Duplicates FROM
    ForumUsers WHERE ForumUsers.UserName=jimmy GROUPBY
    ForumUsers.UserName
    DATASOURCE Education Forum
    VENDORERRORCODE -3100
    SQLSTATE 42000
    I've run into this before, but I don't seem to be able to
    grasp the general principle involved.
    I'd be very grateful if someone could explain the error in
    this particular case and how I can avoid the problem in the futre.
    Thanks, once again, very much in advance.

    Thanks for the suggestions. I've changed the code to
    incorporate the advice as far as I can. It now reads:
    <cfif NOT structIsEmpty(form)>
    <cfparam name = "form.user" default = 0>
    <cfparam name = "form.password" default = 0>
    <cfparam name = "form.Email" default = 0>
    <cfparam name = "form.MaidenName" default = 0>
    <cfquery name="CheckUserName" datasource= "Education
    Forum">
    SELECT Uname, Count(Uname) as Duplicates
    FROM ForumUsers
    WHERE ForumUsers.Uname='#form.user#'
    GROUPBY ForumUsers.Uname
    </cfquery>
    <cfquery name="CheckPassword" datasource= "Education
    Forum">
    SELECT Pword, Count(Pword) as Duplicates
    FROM ForumUsers
    WHERE ForumUsers.Pword="AK"
    GROUPBY Pword
    </cfquery>
    Unfortunately, it still fails giving me the same error:
    Access Driver] Syntax error (missing operator) in query
    expression 'ForumUsers.Uname='adk' GROUPBY ForumUsers.Uname'.
    The Error Occurred in C:\CFusionMX\wwwroot\Education\Bulletin
    Board\Education - Bulletin Board - Register - code.cfm: line 11
    9 : WHERE ForumUsers.Uname='#form.user#'
    10 : GROUPBY ForumUsers.Uname
    11 : </cfquery>
    12 : <cfquery name="CheckPassword" datasource= "Education
    Forum">
    13 : SELECT Pword, Count(Pword) as Duplicates
    SQL SELECT Uname, Count(Uname) as Duplicates FROM ForumUsers
    WHERE ForumUsers.Uname='adk' GROUPBY ForumUsers.Uname
    DATASOURCE Education Forum
    VENDORERRORCODE -3100
    SQLSTATE 42000
    I think its just a SQL error as I get the same failure
    message if I replace '#form.user#' with say 'GAK'.
    Any further suggestions would be greatly appreciated.
    P.S. I'm still a novice, so how would I use
    <cfqueryparam> tags here?

  • Problem with Prepared Statement & MS Access

    Hi
    I have tried to find some info about this but can't see anything specific to what I think the problem may be. Hopefully someone can point me in the right direction.I am trying to get information out of an MS Access database using a Prepared Statement but I am getting strange results.
    When I run the query in the database it gives me the correct totals (�51) for 4 records. When I run the Prepared Statement ,I get 81. Has it got anything to do with the data type I am using( sorry if this is a really basic question). here is my code- the connection etc is elsewhere.
    private void getReportMoneyTotal() throws SQLException
              Calendar todayTotal =Calendar.getInstance() ;
               SimpleDateFormat reportDateFormat = new SimpleDateFormat("dd MM yyyy");
              PreparedStatement preparedT =context.getConnection().prepareStatement(
                   "SELECT Sum(tblSession.Fee) AS Total, Count(tblBooking.BookingID) AS CountOfBookingID FROM tblSession INNER JOIN "+
                   "(tblBooking INNER JOIN tblCustomer_Booking ON tblBooking.BookingID = tblCustomer_Booking.BookingID) ON tblSession.SessionID = tblBooking.SessionID "+
                   "WHERE (((tblBooking.EventDate)>DateAdd('m',-1,#"+reportDateFormat.format(todayTotal.getTime())+"#)) AND ((tblSession.Session)='Morning' Or (tblSession.Session)='Evening')) OR (((tblSession.Session)='Afternoon') AND ((tblBooking.Extension)=Yes))"
              ResultSet resultTotal =preparedT.executeQuery();
              resultTotal.next();
              Double total =resultTotal.getDouble("Total");
              Locale locale = new Locale("GBP");
            NumberFormat gbpFormat = NumberFormat.getCurrencyInstance(locale);
              System.out.println(gbpFormat.format(total));
              preparedT.close();
         }I do realise that my code probably isn't very elegant but I'm only learning!

    Hi Matt--
    I am not clear if you are saving the url with the # # around
    the text or if
    the
    data already contains the # marks.
    When you insert a link, you want to make sure you insert is
    insert into table ( link1) values ( <cfqueryparam
    cfsqltype="cf_sql_varchar"
    value='#linkvaluehere#'> )
    remember to
    1) enclose your data's value inside quotes (some databases
    are picky about
    single v. double quotes).
    2) if it IS in quotes, swap doubles for singles and see if
    that helps.
    3) make sure your data being saved is NOT double hashed like
    '##linkvalueher##'. Double ##'s tell
    Coldfusion not to treat it as a variable.
    hope his helps,
    tami
    "Mattastic" <[email protected]> wrote in
    message
    news:f9c7h0$8ub$[email protected]..
    | Hi Folks,
    |
    | I'm storing a link in a nvarchar field in SQL server,
    www.foo.co.uk, it
    looks
    | and works fine in SQL server. Problem occurs when I setup
    an ADP in Access
    and
    | insert links. Certain links have a hash symbol around them.
    so
    |
    http://www.foo.co.uk, would be #
    http://www.foo.co.uk# which is
    causing
    problems.
    |
    | Can anyone tell me why this is happening? and how to stop
    it?
    |
    | Thankyou
    |

  • Error Handling for CFQUERYPARAM

    Is there a way to display the value of cfqueryparam upon a database error?  For example:
    <cfquery name="causeError" datasource="#application.dsn#">
          select street1 from house, #table2# where house.houseid = #table2#.houseid and house.houseid = #form.houseid#
    </cfquery>
    The variable table2 is dynamically generated and let's say an error is caused table2 being an empty string or a table that doesn't exist.  So the error given is:
    [Macromedia][Oracle JDBC Driver][Oracle]ORA-00903: invalid table name
    4 : <cfquery name="causeError" datasource="#application.dsn#">
    5 : select street1 from house, #table2# where house.houseid = #table2#.houseid and house.houseid = #form.houseid#
    6 : </cfquery>
    SQL   select street1 from house, where houseid = 123;
    So I know that the user was trying to look at a house with houseid = 123.  I can then try to replicate the error using the same record in the database which can ultimately can help me diagnose the problem more quickly.
    However, if I use cfqueryparam, i.e.:
    <cfquery name="causeError" datasource="#application.dsn#">
          select street1 from house, #table2# where house.houseid = #table2#.houseid and house.houseid = <cfqueryparam value="#form.houseid#" cfsqltype="cf_sql_integer">
    </cfquery>
    I get:
    [Macromedia][Oracle JDBC Driver][Oracle]ORA-00903: invalid table name
    4 : <cfquery name="causeError" datasource="#application.dsn#">
    5 : select street1 from house, #table2# where house.houseid = #table2#.houseid and house.houseid = <cfqueryparam value="#form.houseid#" cfsqltype="cf_sql_integer">
    6 : </cfquery>
    SQL   select street1 from house, where house.houseid = .houseid and house.houseid = (param 1)
    I have no idea what the user entered.

    The cfqueryparam value is buried deep in the cfcatch structure. You may get to it, for example, by doing something like this:
    <cftry>
    <!--- Put your query here --->
    <cfcatch type="database">
        <cfdump var="#cfcatch.where#">
    </cfcatch>
    </cftry>

  • Problem with queryparams

    Recently upgraded to Coldfusion 7 using JDBC drivers (V 3.5)
    with Oracle 8i. Since then we have been getting problems with some
    queryparams in <cfquery> SQL statement...., eg,
    <cfqueryparam
    value="#ValueList(get_service.ct_service_id)#" list="yes">. This
    returns the following error:
    Error executing Databse query. [Macromedia][Oracle JDBC]
    Internal error: Net8 protocol error.
    <cfqueryPARAM value="#arguments.request_id#"
    cfsqltype="cf_sql_integer" maxlength="10"> This returns the
    following error:
    For input string: ":099960" null.
    Can anyone help?

    Hi, Beverley.  
    Thank you for visiting Apple Support Communities.  
    I understand that you are unable to trim clips using iMovie.  I would need a little more information on how you were attempting to trim a clip to provide a better answer.  However, make sure you have the movie project open and are selecting the clip that you wish to trim as this will activate the clip trimmer.  
    Trim clips
    -Jason H.  

  • Error in cfqueryparam, when getting date field from cfpop

    Hi all,
    i'm taking data from cfpop to store them in the database.
    There are problems with date data:
    INSERT .....
    POST_DATE = <cfqueryparam value="#date#"
    cfsqltype="cf_sql_timestamp">
    But it fails in some situations, for instance:
    The cause of this output exception was that:
    coldfusion.runtime.locale.CFLocaleBase$InvalidDateTimeException:
    "19 Sep 2006 00:51:33 +0200" is an invalid date or time string
    Ok, I'm using English locale and tried to use
    ParseDateTime(date, 'pop'). But it doesn't work either (!):
    "19 Sep 2006 00:51:33 +0200" is not a valid date format. But
    'pop' supposes, that this is format with time zone offset!!
    P.S. The problem was that some email messages had incorrect
    date format: one didn't have a day of week, another one - even day
    of month!!!
    To make life simpler, i've just added a regexp check:
    <cfif
    ReFindNoCase("[A-z]{3}\,\s[0-9]{2}\s[A-z]{3}\s[0-9]{2,4}\s[0-9]{2}:[0-9]{2}:[0-9]{2}\s(?: \+|\-)?[0-9]{4}",
    date, 0)>
    <cfset dateField = date>
    <cfelse>
    <cfset dateField = now()>
    </cfif>
    I'm not going to parse every possible date format
    error.

    I don't believe there's anyway to have Access ignore it on an import. What you can try instead is link to the file (instead of importing it) and write a query that updates the table based on the linked table, with an appropriate edit on the date/time field.
    Doug Steele, Microsoft Access MVP
    http://www.AccessMVP.com/djsteele (no e-mails, please!)
    Co-author
    Access Solutions — Tips, Tricks, and Secrets from Microsoft Access MVPs (ISBN 978-0-470-59168-0)

  • ColdFusion Verity Search Float Problem

    I have a database full of products.  One of the fields for each product in the database is a minimum price.  I'm trying to create a search that says something like "find all products with a minimum price between X and Y."  However, when it returns results, it includes numbers that are out of the range.  For instance, if I say between 2 and 3 dollars, it will return the correct results but will include numbers like 25.00 and 245.00, and when I do something like "between 4 and 5 dollars" it returns the correct results with additional numbers like "40.00" and "434.00."  So it seems to me that ColdFusion can't process the floating number correctly...It sees a number like "40.00" and assumes its in the range between 4 and 5.  Here is my code for the indexing:
    <cfquery name="v_qryProductInfo" datasource="#application.DSN#">
    SELECT DISTINCT    SP.pk_storeProductID,
                    P.productName,
                    C.categoryName,
                    P.prodTimeMin,
                    P.prodTimeMax,
                    PD.miniDesc,
                    PD.keywords,
                    CONVERT(float, (dbo.getMinPrice(pk_storeProductID))) AS minPrice
    FROM             tblProduct P
    INNER JOIN        tblProductDescription PD ON P.pk_productID = PD.fk_productID
    INNER JOIN        tblStoreProduct SP ON P.pk_productID = SP.fk_productID
    INNER JOIN        tblProductSubCategory PSC ON SP.pk_storeProductID = PSC.fk_productID
    INNER JOIN        tblSubCategory SC ON SC.pk_subCategoryID = PSC.fk_subCategoryID
    INNER JOIN        tblCategory C ON C.pk_categoryID = SC.fk_categoryID
    WHERE            (SP.blnStoreActive = 1)
    AND                (SP.fk_storeID = #application.storeID#)
    </cfquery>
    <cfdump var="#v_qryProductInfo#">
    <h1>Indexing data...</h1>
    <cfindex
        action="refresh"
        collection="#application.vcCollection#"
        key="pk_storeProductID"
        type="custom"
        title="productName"
        query="v_qryProductInfo"
        body="miniDesc, keywords, pk_storeProductID, minPrice"
        Custom1="minPrice"
        Custom2="prodTimeMin"
        Custom3="prodTimeMax"
        Custom4="categoryName"
    >
    My cfsearch tag criteria looks like this:
        <cfsearch
            criteria="CF_CUSTOM1 >= #priceRangeMin# <AND> CF_CUSTOM1 <= #priceRangeMax#"
            name="qryFoundProducts"
            collection="#application.vcCollection#">
    I've made the Custom1 column for the indexing the "minPrice" which is calculated as a function in my database.  I've even tried making sure the number that is being entered in the Custom1 index is a float by using the CONVERT function in my SQL code.  Any ideas why ColdFusion can't properly relate a float?  It seems like it's trying to compare a string and a float, which isn't working too well.
    Any info would be greatly apprecaited.

    Well, firstly: don't blame Adobe for Verity... Verity is (well: was) a separate product, and I don't think Verity as a company has even existed during Adobe's tenure at the helm (to mix metaphors awkwardly) of CF.
    That said, one perhaps can blame Adobe for any disconnect between Verity and CF's support thereof, if Verity does actually support numeric processing, and CF mungs that somehow.  I'm not saying this is the case, but who knows?
    What Adobe perhaps didn't do is ditch or deprecate Verity earlier than it did.  Lucene's been around for ages, and has been solid for ages, so I don't know why they didn't revise their search engine support earlier than they did.  Oh well.
    Now: your issue.
    First thing, this won't work:
    <cfset keyList = #Val(ValueList(qryFoundProducts.key))#>
    val() returns the value of a number, whereas valueList() returns... a list.  So it val() works at all, the result will just be the value of the first number in the list.  You also don't need the pound-signs there, but either way, it won't affect your situation.
    Second, as CF is loosely typed, it doesn't matter if you pass a numeric string or an actual number to a <cfqueryparam> tag, if you've said the value is supposed to be an integer (CF_SQL_INTEGER), then CF will automatically convert it to an integer if it can.  So provided the values in your query column can be expressed as integers, they will convert with no intervention on your part.
    So, in that light, I'm not sure your problem is necessarily what you think it is..?
    But you say there's a problem in your WHERE clause, but you don't actually say what the problem actually is.  Are you getting an error?  Or just no records?  The wrong records?
    What do you see if you dump the query out?  If you take the values output by valueList() and execute the query with those values in a different DB client (like MS SQL Studio or whatever), do you get the results you expect?
    What sort of data is in the Verity collection btw?  Are they documents, or DB data, or a mix, or what? If there are PKs coming out of the collection, it sounds like the data came from a DB in the first place.  Can you not use full-text searching in your DB, and leave Verity out of the equation?
    Adam

  • Query Problem when converting from access to Mysql

    I am trying to get a small application to work with a mysql
    db. The original
    db is access, for some reason I am getting an error now that
    the db has been
    converted over to mysql. Any gurus out there spot the
    problem. Here is the
    query:
    <cfquery name="getprevmonth"
    username="#request.myDBUserName#"
    password="#request.myDBPassword#"
    datasource="#request.myDSN#">
    SELECT cal_date,(day(cal_date)) AS theprevmonth
    FROM jot_eventcal
    WHERE (cal_date >=
    #CreateDate(Year(prev_date),Month(prev_date),1)#) and
    (cal_date <=
    #CreateDate(Year(prev_date),Month(prev_date),DaysInMonth(prev_date))#)
    </cfquery>
    This query works fine when I test the application Locally, it
    only messes up
    when I test online. The error code is:
    Syntax error or access violation: You have an error in your
    SQL syntax.
    Thanks for any assistance in advance...........and a happy
    new year to you
    all.

    I don't know the answer but, it might be that using
    createdate is not sufficient. Try wrapping that date into either a
    cfqueryparam or createodbcdate.
    Something else to bear in mind when switching db's is that
    they don't all have the same functions. I don't use mySql so I
    don't actually know, but I'd be checking the manual to make sure it
    has a day function.
    Not a syntax, but a potential logic error is that you are
    using a function called day to create an alias called theprevmonth.
    At the very least, it's misleading and might confuse you later
    on.

  • Cfquery sql update loop problem

    Trying something a bit tricky, need some ideas.
    I've got an array of objects that I pass to a cfc from flex, I'm trying to save this array to the database.
    Here's what I have that doesn't work.
    <cfquery name="setObjDetail" datasource="test">
         UPDATE ObjTable
         SET
         <cfloop index="i" from="1" to="#len(objDetails)#">
              #objDetails[i].Name# = '#objDetails[i].Value[1]#' ,
         </cfloop>
    WHERE OBJID = <cfqueryparam value="#objID#" cfsqltype="cf_sql_integer">
    </cfquery>
    The error I'm getting is
    faultCode:Server.Processing faultString:'Unable to invoke CFC - Complex object types cannot be converted to simple values.' faultDetail:'The expression has requested a variable or an intermediate expression result as a simple value, however, the result cannot be converted to a simple value. Simple values are strings, numbers, boolean values, and date/time values. Queries, arrays, and COM objects are examples of complex values. <p> The most likely cause of the error is that you are trying to use a complex value as a simple one. For example, you might be trying to use a query variable in a cfif tag.'
    I have the feeling it's due to the equals symbol (and maybe the comma at the end too). I've tried putting cfoutput tags around it, using ToString method... running out of ideas.
    Both #objDetails[i].Name#  and  #objDetails[i].Value[1]# evaluate correctly.
    Thanks.

    Hi guys thanks for the replies.
    Yes I'd figured out it was ArrayLen which was the problem in the error message.
    I still have problems, I think it's because Coldfusion doesn't like that equals sign... so I tried
    <cfquery name="setObjDetail" datasource="test">
         UPDATE ObjTable
         SET
         <cfloop index="i" from="1" to="#ArrayLen(objDetails)#">
              #objDetails[i].Name# & " = '" & #objDetails[i].Value[1]# & "',"
         </cfloop>
    WHERE OBJID = <cfqueryparam value="#objID#" cfsqltype="cf_sql_integer">
    </cfquery>
    However this is giving me the following error
    faultCode:Server.Processing faultString:'Unable to invoke CFC - You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members.' faultDetail:''
    Which also comes up when I just have
    <cfquery name="setObjDetail" datasource="test">
         UPDATE ObjTable
         SET
         <cfloop index="i" from="1" to="#ArrayLen(objDetails)#">
              #objDetails[i].Name# = '#objDetails[i].Value[1]#' ,
         </cfloop>
    WHERE OBJID = <cfqueryparam value="#objID#" cfsqltype="cf_sql_integer">
    </cfquery>
    So maybe it's nothing to do with the equals sign.
    Any suggestions?

  • CFQUERYPARAM tag not working in GROUP BY clause

    I am getting an error whenever I put a CFQUERYPARAM tag in a
    GROUP BY clause. I saw on another message board someone was having
    a similar problem with the ORDER BY clause
    Here is a sample of what my code might look like
    select x, y, z from abc
    group by <cfqueryparam value="x"
    cfsqltype="cf_sql_float">
    Here is the error I receive.
    Error Executing Database Query.
    [Macromedia][Oracle JDBC Driver][Oracle]ORA-00979: not a
    GROUP BY expression
    Any insight?

    The cachedwithin and cachedafter functions store the query
    results in the server's RAM. That means, while it's cached,
    whenever you run it, you get the cached result instead of going to
    the database to run it again. This increases speed of course, but
    if the data changes during the cache period, you have accuracy
    problems.
    It does not create memory issues. In the administrator you
    reserve a certain amount of memory for query caching. If you exceed
    that amount, the last query in pushes the first query out, or
    something like that.
    With regards to what you are trying to do about binding
    variables in your group by clause, that's not what cfqueryparam was
    designed for. It was designed for
    where clauses (where this = <cfqueryparam etc>
    or insert queries (insert into my table (field) values
    (<cfqueryparam>
    and things like that.
    You are trying to use it for something other than what it was
    designed for, which explains why it's not working for you.

  • CFC method memory problem

    Hi all,
    I use CFCs a lot, so when I was creating a tool to migrate
    some database tables, I built the actual data transfer function as
    a method of a CFC. The basic code just reads a block of 1000
    records from the old db, does some minor manipulation of the data,
    and then inserts the records into the new db a record at a time
    inside a cfloop. Lather, rinse, repeat, until all of the 500K+
    records have been transferred.
    I was surprised to find that this leads to Java out of memory
    errors around the 200Kth record (given my current JVM memory
    settings). Having run across a similar problem when sending
    broadcast emails from a CFC method, I simply moved the code out of
    the CFC method and into the calling cfm page, and it ran through
    all of the records without any problems.
    The only explanation I can think of for this behavior is that
    when the code is inside a CFC method, the query object used to read
    the blocks of 1000 records keeps getting reallocated rather than
    reused, so when it gets to the point of trying to store 200 blocks
    of 1000 records in memory, it runs out of room. If that's the case,
    it would seem to be a significant bug that needs to be fixed.
    Does anyone know if that's what is really going on?
    Thanks,
    Russ

    > Actually, there is a good reason to put the code in a
    cfc: there are almost 100
    > tables to migrate, so the code gets rather long and
    cumbersome to wade through
    > if it isn't broken up.
    Fair enough. Youd didn't really tell us that part before,
    though.
    So you have a calling template which calls an equivalent to
    this function
    for 100-odd tables? Yikes. I'll reiterate my question whether
    this can't
    possibly be done DB to DB or via a bulk insert.
    > thing, but ultimately my question really has nothing to
    do with this particular
    > tool. I would really just like to understand why the out
    of memory issue exists
    > when the code is in a CFC method versus when it is in a
    CFM. This issue has
    Well it kinda is about this particular tool, because it's
    this code that's
    causing the problems (or something about the calling code, or
    something
    like that). Obviously there's some idiosyncasy of it which
    gives you
    problems when it's in a CFC method as opposed to mainline
    code, but I would
    not immediately say it's a generic problem with CFCs vs CFMs.
    Just yet.
    Is this the first table that's being migrated? Or is it
    buried somewhere
    within the other 100-odd? Is it always this one, or can it
    happen on any
    of them?
    Can you inspect the memory usage between each table's
    function, and see if
    there's anything unexpected going on (other than it running
    out of memory,
    which is - in itself - unexpected!).
    Do you have 100-odd methods (one for each table) in the CFC,
    or lots of
    individual CFCs?
    I guess you could call a GC in between each table's
    processing, and see if
    you can keep check on memory usage that way. Or maybe check
    memory levels
    within that loop you've got, and if it starts flaring up, doa
    GC then.
    It's not advised to call GCs "by hand", but I have found it's
    helped some
    times.
    Have you sued CF's server monitor or something like
    FusionReactor to check
    if anything unexpected is consuming RAM?
    I think you should try adding <cfqueryparam> tags to
    your queries: CF might
    be cachinng some info about them, and that could be leaking
    memory or
    something. Maybe try <cfobjectcache action = "clear">
    between each method
    callor something.
    I wonder if there's something about the fact you're replacing
    oldInfo with
    a new query within a loop that has a condition based on
    oldInfo's record
    count. Possibly this is forcing CF to maintain the previous
    oldInfo
    queries in the background, so you're not actually overwriting
    the previous
    one with the next one when you requery, you're actually just
    getting a new
    pointer assigned. Do me a favour, and do this:
    <cfset iRecCount = OldInfo.RecordCount>
    <cfloop condition="iRecCount GT 0">
    <!--- Load the old info --->
    <cfquery name="OldInfo" datasource="dsOld"
    maxrows="#GetRecsCount#">
    </cfquery>
    <cfset iRecCount = OldInfo.RecordCount>
    </cfloop>
    This is a slightly far-fetched notion, but it doesn't hurt to
    try: it's a
    pretty easy change.
    > come up enough times now that I'd like to determine if
    there is a workaround.
    > Due to the deadline I'm on, I haven't tried simply
    assigning the query object
    > to an empty string at the end of each iteration yet, but
    I will try to do so
    > soon so I can report on the result.
    It might pay to apply a test rig to this notion first:
    0) on a dev machine without any other activity
    1) grab the heap usage
    2) load a big query in
    3) grab the heap usage (should losely reflect the fact you've
    just stuck a
    chunk of data in RAM)
    4) set the query variable to be an empty string
    5) grab the heap usage. Check to see if the memory is
    reclaimed straight
    away.
    You might need to do a GC between 4+5 for it to take effect.
    I speculate
    that the RAM won't get freed up straight away, and you might
    be consuing it
    faster than the JVM can clear it.
    Adam

  • Problem inserting record using INSERT INTO

    I am an amateur web builder using some ColdFusion functionality to access information on an Access database. I know very little about ColdFusion syntax, but I'm using Dreamweaver CS3 to help generate most of the code. I'm working on an insert record page to create a user database with login information. I'm not sure what the problem is, but I'm getting a syntax error referencing this particular portion of the code:
    Syntax error in INSERT INTO statement.
    The error occurred in C:\ColdFusion9\wwwroot\Everett\register.cfm: line 22
    Below is the entire page with line 22 (referenced in the error message) in red. Any ideas?
    <cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>
    <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "register">
      <cfquery datasource="everettweb">  
        INSERT INTO Users ([First Name], [Last Name], [Email Address], Password)
    VALUES (<cfif IsDefined("FORM.first_name") AND #FORM.first_name# NEQ "">
    <cfqueryparam value="#FORM.first_name#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
    , <cfif IsDefined("FORM.last_name") AND #FORM.last_name# NEQ "">
    <cfqueryparam value="#FORM.last_name#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
    , <cfif IsDefined("FORM.email") AND #FORM.email# NEQ "">
    <cfqueryparam value="#FORM.email#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
    , <cfif IsDefined("FORM.password") AND #FORM.password# NEQ "">
    <cfqueryparam value="#FORM.password#" cfsqltype="cf_sql_clob" maxlength="255">
    <cfelse>
    </cfif>
      </cfquery>
      <cflocation url="register_success.cfm">
    </cfif>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Main.dwt" codeOutsideHTMLIsLocked="false" -->
    <head>
    <link href="main.css" rel="stylesheet" type="text/css" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>Everett Music Department, Everett, MA</title>
    <!-- InstanceEndEditable -->
    <style type="text/css">
    <!--
    body {
    background-color: #660000;
    -->
    </style>
    <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    //-->
    </script>
    <!-- InstanceBeginEditable name="head" -->
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    <script src="SpryAssets/SpryValidationConfirm.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationConfirm.css" rel="stylesheet" type="text/css" />
    <!-- InstanceEndEditable -->
    <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    a:link {
    color: #660000;
    a:visited {
    color: #A01D22;
    a:hover {
    color: #FFCC00;
    -->
    </style>
    <link href="main.css" rel="stylesheet" type="text/css" />
    </head>
    <body onload="MM_preloadImages('menu_about_over','menu_ensembles_over.jpg','menu_schools_over.j pg','menu_events_over.jpg','menu_faculty_over.jpg','menu_contacts_over.jpg','menu_home_ove r.jpg','menu_about_over.jpg','menu_links_over.jpg','menu_login_over.jpg')">
    <table width="960" align="center" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="3"><img src="top_border.jpg" width="960" height="20" align="top" /></td>
      </tr>
      <tr align="center">
        <td colspan="3"><a href="index.php"><img src="e_oval_top.jpg" height="100" width="270" border="0" /></a><a href="index.php"><img src="header.jpg" height="100" width="690" border="0" /></a></td>
      </tr>
      <tr>
        <td height="35" width="301"><a href="index.php"><img src="e_oval_bottom.jpg" height="35" width="234" border="0" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','menu_home_over.jpg',1)"><img src="menu_home.jpg" width="67" height="35" name="home" border="0" id="home" /></a></td>
        <td width="251"><ul id="MenuBar1" class="MenuBarHorizontal">
          <li><a class="MenuBarItemSubmenu" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('about','','menu_about_over.jpg',1)"><img src="menu_about.jpg" width="71" height="35" name="about" border="0" id="about" /></a>
            <ul>
              <li><a href="#">News</a></li>
              <li><a href="#">History</a></li>
              <li><a href="#">Media</a></li>
            </ul>
          </li>
          <li><a class="MenuBarHorizontal" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('ensembles','','menu_ensembles_over.jpg',1)"><img src="menu_ensembles.jpg" width="98" height="35" name="ensembles" border="0" id="ensembles" /></a>
            <ul>
              <li><a href="#">Band</a></li>
              <li><a href="#">Chorus</a></li>
              <li><a href="#">Strings</a></li>
            </ul>
          </li>
          <li><a class="MenuBarItemSubmenu" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('schools','','menu_schools_over.jpg',1)"><img src="menu_schools.jpg" width="82" height="35" name="schools" border="0" id="schools" /></a>
            <ul>
              <li><a href="#">Everett High School</a></li>
              <li><a href="#">English School</a></li>
              <li><a href="#">Keverian School</a></li>
              <li><a href="#">Lafayette School</a></li>
              <li><a href="#">Parlin School</a></li>
              <li><a href="#">Webster School</a></li>
              <li><a href="#">Whittier School</a></li>
            </ul>
          </li>
        </ul>
        </td>
               <td width="408"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('events','','menu_events_over.jpg',1)"><img src="menu_events.jpg" width="74" height="35" name="events" border="0" id="events" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('faculty','','menu_faculty_over.jpg',1)"><img src="menu_faculty.jpg" width="79" height="35" name="faculty" border="0" id="faculty" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('links','','menu_links_over.jpg',1)"><img src="menu_links.jpg" width="66" height="35" name="links" border="0" id="links" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('login','','menu_login_over.jpg',1)"><img src="menu_login.jpg" name="login" width="69" height="35" border="0" id="login" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contact','','menu_contact_over.jpg',1)"><img src="menu_contact.jpg" width="100" height="35" name="contact" border="0" id="contact" /></a><img src="menu_spacer_end.jpg" width="20" height="35" /></td>
      </tr>
      <tr height="10">
        <td colspan="3"><img src="menu_bottom_spacer.jpg" height="10" width="960" /></td>
      </tr>
    </table>
    <table width="960" cellpadding="0" cellspacing="0" align="center">
      <tr height="50">
        <td width="30" background="left_border.jpg"><img src="clear.gif" width="30" height="50" /></td>
        <td width="900" bgcolor="#FFFFFF">
          <table width="900" cellpadding="0" cellspacing="0">
            <tr>
              <td width="900" height="350" valign="top"><!-- InstanceBeginEditable name="PageBody" -->
          <form action="<cfoutput>#CurrentPage#</cfoutput>" method="POST" name="register" preloader="no" id="register">
                <table width="100%">
                  <tr>
                    <td colspan="2" class="heading1">Fill in the information below to register for this site:</td>
                  </tr>
                  <tr>
                    <td colspan="2"><img src="clear.gif" height="15" /></td>
                  </tr>
                  <tr>
                    <td width="50%" class="form" align="right">First Name:</td>
                    <td width="50%"><span id="sprytextfield1">
                      <input type="text" name="first_name" required="yes" id="first_name" width="150" typeahead="no" showautosuggestloadingicon="true" />
                      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Last Name:</td>
                    <td><span id="sprytextfield2">
                      <input type="text" name="last_name" required="yes" id="last_name" width="150" typeahead="no" showautosuggestloadingicon="true" />
                      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Email Address:</td>
                    <td><span id="sprytextfield3">
                    <input type="text" name="email" validate="email" required="yes" id="email" width="150" typeahead="no" showautosuggestloadingicon="true" />
                    <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Confirm Email Address:</td>
                    <td><span id="sprytextfield4"><span id="ConfirmWidget">
                    <input type="text" name="email_confirm" validate="email" required="yes" id="email_confirm" width="150" typeahead="no" showautosuggestloadingicon="true" />
                    <span class="confirmInvalidMsg">The values do not match</span></span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Password:</td>
                    <td><span id="sprytextfield5">
                      <input type="password" name="password" required="yes" id="password" width="150" />
                      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
                  </tr>
                  <tr>
                    <td class="form" align="right">Confirm Password:</td>
                    <td><span id="sprytextfield6"><span id="ConfirmWidget">
                      <input type="password" name="password_confirm" required="yes" id="password_confirm" width="150" />
                      <span class="confirmInvalidMsg">The values do not match</span></span></span></td>
                  </tr>
                  <tr>
                    <td> </td>
                    <td><input name="submit" type="submit" id="submit" value="Register" /></td>
                  </tr>
                </table>
          <input type="hidden" name="MM_InsertRecord" value="register" />
          </form>
          <script type="text/javascript">
    <!--
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "email");
    var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "email");
    var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
    var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
    //-->
    </script>
    <script type="text/javascript">
    var ConfirmWidgetObject = new Spry.Widget.ValidationConfirm("sprytextfield4", "email");
    var ConfirmWidgetObject = new Spry.Widget.ValidationConfirm("sprytextfield6", "password");
    </script>
              <!-- InstanceEndEditable --></td>
            </tr>
          </table>
        </td>
        <td width="30" background="right_border.jpg"><img src="clear.gif" width="30" height="50" /></td>
      </tr>
      <tr>
        <td colspan="3" background="footer.jpg" class="footer" height="80"/>This website best viewed using:<br /><a href="http://www.firefox.com"><img src="firefox_logo.gif" width="110" height="40" border="0" /></a></td>
      </tr>
    </table>
    <script type="text/javascript">
    <!--
    var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
    //-->
    </script>
    </body>
    <!-- InstanceEnd --></html>

    Syntax error in INSERT INTO statement.  INSERT INTO Users ([First Name], [Last Name], [Email Address], Password)
    That oh-so-uninformative error is because "Password" is a reserved word with your database driver.  Either escape it by putting square brackets around it too, or rename the column permanently. It is best to avoid using reserved words whenever possible. So renaming the column is the better option.  Also, I would try and avoid using invalid characters like spaces in column names ie "First Name". It is technically allowed, but it requires special handling everywhere which adds unecessary complexity.
    I'm not sure what the problem is, but I'm getting a syntax error referencing this particular portion of the code:
    Do not take the error line numbers as gospel. Sometimes they just indicate that the error is within the vincinty of that line.
    I'm using Dreamweaver CS3 to help generate most of the code
    Unforutnately, DW wizards generate some truly awful and verbose code.  To give you an idea, here is what the query should look like, without all the wizard nonsense.
      <cfparam name="FORM.first_name" default="">
      <cfparam name="FORM.last_name" default="">
      <cfparam name="FORM.email" default="">
      <cfparam name="FORM.FORM.password" default="">
      <cfquery datasource="YourDSNName"> 
        INSERT INTO Users ([First Name], [Last Name], [Email Address], [Password])
        VALUES (
          <cfqueryparam value="#FORM.first_name#" cfsqltype="cf_sql_varchar">
         , <cfqueryparam value="#FORM.last_name#" cfsqltype="cf_sql_varchar">
         , <cfqueryparam value="#FORM.email#" cfsqltype="cf_sql_varchar">
         , <cfqueryparam value="#FORM.password#" cfsqltype="cf_sql_varchar">
      </cfquery>
    CF is pretty easy to learn. You might want to begin perusing the CF documentation and a few tutorials to get more familiar with the language. Since you are working with a database, I would also recommend a  SQL tutorial.

  • Preventing SQL injection - can't use cfqueryparam in this case

    Hello. I have a form with a checkbox next to each row.  If the user checks some boxes, then clicks the "Delete" button, I want to execute the following query, but I want to protect it from sql injection attacks:
        <cfquery datasource="#application.mainDS#">
            delete userMessages
            where messageID in (#form.messageID#)
        </cfquery>
    As written above, it works fine.  But if I try to protect this code with <cfqueryparam value="#form.messageID#" cfsqltype="cf_sql_varchar">, I get this error: "Conversion failed when converting the varchar value '7,21' to data type int" (7 and 21 are the messageID's to be deleted).  Obviously the comma prevents conversion to an integer.
    If I use cfsqltype="cf_sql_integer", then the string gets converted to a single integer (in this case 40015, which is nonsense).
    I tried passing form.messageID to a stored procedure, but I seemed to have the same problem there.  I could run the query in a loop where I just delete one row at a time, but I'd like to run just one query if I can do it safely.  Any ideas?
    Thanks.
    PK

    I agree that you should not do an SQL "DELETE" from a web page.  Instead, use "soft deletes," where you contrive for there to be a deleted_flag (boolean), and maybe deleted_by (varchar) and deleted_timestamp.  Then create an SQL "VIEW" which automagically omits the "deleted" records.
    It is also a very good idea to refer to the records using a nonsensical, made-up "moniker" instead of actual record-IDs.  You see, "if I am a nasty person and I know that there is a record #123456, then I'll bet I know the record-IDs of 123,455 other records, too."  But if you refer to the record as "QZB0E9S" and the next record-id in the list is "4Q_9RJPEM2" then it won't take me long to realize that I can't get too far, not even by brute-force.  (And if I see that the record-IDs seem to have verification tags, like "QZB0E9S:4E396", then I know that I am really scroo'd in my hacking-attempt because even if I did somehow million-monkeys my way into a valid record-ID, I've got no earthly idea how to come up with the tag.
    It pays to code defensively, like this.  And it doesn't really take more time.  Without question, always use <cfqueryparam> !!

  • Problem looping insert query

    I'm working on inserting a recordset up Google Calendar entries into my site database. I have a form set up that allows me to insert new entries into the data table, but when I try to loop the insert query over the Google recordset, I get nothing (no errors, but no entries added to database).
    Here's my form, which both displays the values from the Google query and populates fields (mostly hidden) with those values to submit to the Insert query. There's also a line that checks to make sure the event hasn't been canceled (canceled events are still listed, the start and end times are just set to null values):
    <form method="post" action="<cfoutput>#CurrentPage#</cfoutput>">
    <table cellpadding="2" border="1">
    <cfset thisRow = 0>
    <cfloop query="band_events">
    <cfif IsDefined("starttime") AND IsDefined("endtime") AND starttime NEQ "" AND endtime NEQ "">
    <cfset thisRow = thisRow + 1>
    <cfoutput>
    <tr>
      <td>#thisRow#</td>
      <td><input name="update#thisRow#" type="checkbox" checked="checked" /></td>
      <td><input name="calendar#thisRow#" type="hidden" value="Band" />Band</td>
      <td><input name="creator#thisRow#" type="hidden" value="#authoremail#" />#authoremail#</td>
      <td><input name="starttime#thisRow#" type="hidden" value="#starttime#" />#starttime#</td>
      <td><input name="endtime#thisRow#" type="hidden" value="#endtime#" />#endtime#</td>
      <td><input name="title#thisRow#" type="hidden" value="#title#" />#title#</td>
      <td><input name="content#thisRow#" type="hidden" value="#content#" />#content#</td>
      <td><input name="location#thisRow#" type="hidden" value="#where#" />#where#</td>
      <td><input name="ID#thisRow#" type="hidden" value="#ID#" />#ID#</td>
      <td><input name="published#thisRow#" type="hidden" value="#ISOToDateTime(published)#" />#ISOToDateTime(published)#</td>
      <td><input name="updated#thisRow#" type="hidden" value="#ISOToDateTime(updated)#" />#ISOToDateTime(updated)#</td>
    </tr>
    </cfoutput>
    </cfif>
    </cfloop>
    </table>
    <input type="hidden" name="totalRows" value="#row#" />
    <input type="submit" name="submit" value="Submit" />
    <input type="hidden" name="update_events" value="update_events" />
    </form>
    Here's the action script. There's some extra code in there to convert some of the date formats Google uses, and to account for the differences in time zones between the Google values and local time:
    <cfif StructKeyExists(form,"update_events")>
      <cfset loopCount = form["totalRows"]>
      <cfloop index="row" from="1" to="#loopCount#">
        <cfset thisCalendar = form["calendar" & row]>
        <cfset thisCreator = form["creator" & row]>
        <cfset thisStarttime = form["starttime" & row]>
        <cfset thisEndtime = form["endtime" & row]>
        <cfif TimeFormat(thisStarttime,"hh:mm tt") EQ "12:00 AM" AND TimeFormat(thisEndtime,"hh:mm tt") EQ "12:00 AM">
          <cfset thisAllDay = -1>
        <cfelse>
          <cfset thisAllDay = 0>
          <cfset thisStarttime = DateAdd("h",5,thisStarttime)>
          <cfset thisEndtime = DateAdd("h",5,thisEndtime)>
        </cfif>
        <cfset thisTitle = form["title" & row]>
        <cfset thisContent = form["content" & row]>
        <cfset thisLocation = form["location" & row]>
        <cfset thisID = form["ID" & row]>
        <cfset thisPublished = form["published" & row]>
        <cfset thisUpdated = form["updated" & row]>
        <cfquery datasource="ctband">
          INSERT INTO Events (Calendar, Created_By, All_Day, Event_Start, Event_End, Title, Content, Location, ID, Published, Updated) Values (
          <cfqueryparam value="#thisCalendar#" cfsqltype="cf_sql_varchar">,
          <cfqueryparam value="#thisCreator#" cfsqltype="cf_sql_varchar">,
          <cfqueryparam value="#thisAllDay#" cfsqltype="cf_sql_integer">,
          <cfqueryparam value="#thisStarttime#" cfsqltype="cf_sql_timestamp">,
          <cfqueryparam value="#thisEndtime#" cfsqltype="cf_sql_timestamp">,
          <cfqueryparam value="#thisTitle#" cfsqltype="cf_sql_varchar">,
          <cfqueryparam value="#thisContent#" cfsqltype="cf_sql_clob">,
          <cfqueryparam value="#thisLocation#" cfsqltype="cf_sql_varchar">,
          <cfqueryparam value="#thisID#" cfsqltype="cf_sql_varchar">,
          <cfqueryparam value="#thisPublished#" cfsqltype="cf_sql_timestamp">,
          <cfqueryparam value="#thisUpdated#" cfsqltype="cf_sql_timestamp">)
        </cfquery>
      </cfloop>
    </cfif>
    I'm thinking there must be something pretty obvious I've screwed up, but I can't for the life of me find it. Any help would be appreciated!
    JAW

    First, I see this:
    <cfset thisRow = thisRow + 1>
    Which is you counting the number of rows, I assume.  Then I see this:
    <input type="hidden" name="totalRows" value="#row#" />
    But I don't see where #row# has been set.
    You are correct. That was a combination of a couple different attempts at this and I used the wrong variable name on that line. Alas, correcting that didn't solve the problem.
    Then I see this:form["totalRows"]
    When I'm used to seeing this:
    FORM.totalRows
    I've never seen the form["name"] before.  Does that actually work?
    I read somewhere that that's a more effective way of factoring the variable in the name of the form field as an alternative to Evaluate("form.field#row#"). I think it was somewhere on Ray Camden's blog, but it was a while ago. The only reason I used it there was for consistency. That  spot could easily have been FORM.totalRows, but the others would have to be either Evaluate("FORM.calendar#row#") or form["calendar" & row]. Again, I'm learning as I go, though, so I may have used it incorrectly. It's not throwing errors though, it's just reloading a blank page, as if it's submitting the form, but not actually processing the query. That's the confusing part to me.

Maybe you are looking for

  • Function keys do not work on new wireless keyboard

    Hello....my good friend just bought a new iMac G5 2.1 spotlight model computer and has had troubles with his new wireless keyboard in that all 16 function keys do not work at all. Got any ideas or is it just a defective keyboard? He bought this at my

  • Parseing a Float from a string.

    Does anyone know how to parse a float from a string variable? The documentation says there is a method for it, it doesn't say what it is(?). I.e. the equavilent of int this_num.parseint(this_string) only for a float. Thanks.

  • 2nd hand present - mac book pro, having difficulty reinstalling Mavericks

    Hello all, I've been given a Mac Book Pro for a birthday gift (hurray!) However it needed a reinstall so i wiped the harddrive and went to do a clean install and i get the error message that my account is not authorised to download and use Mavericks.

  • Image Capture does not recognize RAW files from Panasonic Lumix G1

    I'm in the process of buying a Lumix G1 camera, but while uploading images from the camera in the store via Image Capture, said app did not recognize its RAW files, only the JPEGs. It works fine with other new cameras such as Nikon D5000, etc. Any id

  • Repository Assistant - vanishes at 0%(while creating new work space)

    Hi Experts, I am new to OWB started learning it(11g R2), I created a user for workspace owner and granted owb_user role with admin option and when I hit finish at the summery page of Repository Assistant it shows a small window with progress bar and