Moonbase7

cf_space

 

July 25, 2009 - 3:22 AM (GMT)

Category: Coldfusion,tech notes
Author: Charles

I was recently adding some features to my CMS system and came accross a feature of cfqueryparam that I had not used in a while but is really nice when you need it.  When doing an insert or update query for an integer field you can specify the Null attribute of the cfqueryparam tag.

Here is an example:

<cfqueryparam cfsqltype="cf_sql_integer" value="#form.duration#" NULL="#NOT len(form.duration)#">

So what this is doing is testing if there is any value in the form.duration field, and if there is nothing there, insert a NULL.  If there is something there is just inserts the field value normally.

 


Share/Save/Bookmark

Archives:
November 2008 (1)
December 2008 (2)
May 2009 (2)
June 2009 (1)
July 2009 (1)
September 2009 (3)
October 2009 (1)
December 2009 (1)
January 2010 (3)
July 2010 (1)
October 2012 (1)

Categories:
Coldfusion (7)
CompositeWeb (1)
coreforms (3)
Crazy Ideas (1)
fun (2)
ios (1)
iphone (1)
mac (3)
nature (1)
Notes (4)
OpenID (1)
Space (1)
tech notes (4)
video (1)
wiki (1)

Authors:
Charles (17)

Search:

rss feed All
rss feed Charles

This is the weblog of Charles Kaufmann.  All thoughts and opinions are solely his own (you wouldn't want them anyway).

Collaboration Suite

Are you looking for a way to get your group/company/non-profit to share files, calendars, forums, and more? CompositeWeb is offering a hosted Collaboration Suite solution so you have no IT costs, just an inexpensive monthly fee.  Try it for 30 days free!

Need some CMS?

If you are looking to create a site like this, check this out!  You can get a full featured site for free, all you have to do is sign up and add content.