> <cfset value = "String"> > <cfquery ..> > INSERT INTO table (field) > VALUES (<cfqueryparam cfsqltype="cf_sql_varchar" value="#value#">> > </cfquery> > > Make the value anything you want, quotes, backslashes etc., it will work.
I did...and it doesn't. But I think I know why now. The inserted data has to be passed directly from an HTML form to CFQUERYPARAM. In other words, you can't set the value directly using CFSET and get the results you expect. But if you enter the value in an INPUT box and send it directly to CFQUERYPARAM, it works great. I've been using CFQUERYPARAM successfully for some time now. When I looked at my code, I noticed that when I'm inserting form values into the DB, I don't use any functions at all to wrap the form variables in the VALUE attribute. But when I output, I wrap the DB values with both HTMLEditFormat() and Trim(). There are all kinds of special characters in the values I'm displaying, including single quotes. But this method of handling the data seems to work very well. > And if you leave the trim() out it will be abc's again. trim() should > not influence the number of quotes, only the numer of spaces at the > beginning and end of the string. I agree that Trim() should not influence a single quote. Nor should HTMLEditFormat(). But both do, even without CFQUERYPARAM. Why? > For a peak at the java behind the scenes, take a look at > http://spike.oli.tudelft.nl/jochemd/index.cfm?PageID=23 Thanks for the link, Jochem...very helpful. I now have a much better understanding of how Java uses JDBC to interact with a database behind-the-scenes. ~Dina ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

