Chad,

Why would you create a variable, and do 3 tests?

Why not

UPDATE tbl_JobOrder
SET JobTitle = '#JobTitle#'
<cfif isdefined("JobDesc")>, JobOrderDesc = '#JobDesc#'</cfif>

I wouldn't test if jobDesc is EQ "" because we might be wanting to set it to "".
I would assume that if it was defined but was an empty string, no??


But if we are talking best practice then It should be scoped.

Ricardo.


Chad wrote:
Be interested in best practice for testing for variables, I know there
is a better way, but most of my updates look like:

--------------------------------------------------
<cfset Disp1 = 0>

<cfif isdefined("JobDesc")>
        <cfif JobDesc NEQ "">
                <cfset Dips1 = 1>
        </cfif>
</cfif>


UPDATE tbl_JobOrder SET JobTitle = '#JobTitle#' <cfif Disp1 EQ 1>, JobOrderDesc = '#JobDesc#'</cfif> --------------------------------------------------

And as far as the PreserveSingleQuotes, I only had to use it when I did
things like:

--------------------------------------------------
<cfset SQLWhere = " AND JobOrderDesc = '" & MyPassedString & "'">

UPDATE tbl_JobOrder
SET JobTitle = '#JobTitle#'
#PreserveSingleQuotes(SQLWhere)#
--------------------------------------------------

Chad

--- You are currently subscribed to cfaussie as: [email protected] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to