Hello,

We are discussing the proper way to initialize a query in a cffunction.  Does 
it make a significant difference to use QueryNew rather than "" (empty string) 
as in the following:

<cfcomponent>
  <cffunction name="test" access="public" returntype="query" output="false">

.....this?
    <cfset var myQuery = "">

.....or this?
    <cfset var myQuery = QueryNew("col1","col2","VarChar","Time">

      <cfquery name="myQuery" datasource="#myDB#">
       ...
      </cfquery>

</cfcomponent>

I learned to use the first version var myQuery = "" from the CFMX Bible and the 
CF documentation but a colleague believes that this is a mistake and that using 
this approach creates the myQuery variable as a string and not as a query.  
Consequently, it is creating a variable of the wrong type.

Any thoughts on this are welcome.

Thanks, Jerry 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346480
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to