> Yes, the NOCOUNT may give you trouble.  However, I noticed something else in 
> your sample code.
>
> You are using #request.datasources# as your datasource for the query.  If you 
> are referring to the http request, you could run into a problem if you decide 
> to put your function into a cfc.
> The cfc, since it runs on a remote server, cannot see the http request.  To 
>get around this, I pass the datasource into the function as a parameter like 
>this:
>
> <cffunction access="public" name="PURCHASE_ORDER_Select" output="false" 
> returntype="query" displayname="PURCHASE_ORDER_Select" hint="Calls
> dbo.usp_PURCHASE_ORDER_Select">
>        <cfargument name="Purchase_Order_ID" default="0" type="Numeric" 
> required="no">
>        <cfargument name="datasource" default="prod" type="String" 
> required="no" />
>
>        <cfstoredproc procedure="usp_PURCHASE_ORDER_Select" 
> datasource="#datasource#" result="PURCHASE_ORDER" returncode="No"  >
>                        <cfprocparam dbvarname="Purchase_Order_ID" type="In" 
> cfsqltype="CF_SQL_INTEGER" value="#arguments.Purchase_Order_ID#" />
>                <cfprocresult name="qPurchaseOrder">
>        </cfstoredproc>
>
>        <cfreturn qPurchaseOrder>
> </cffunction>

While I agree that it would be better to pass in any values needed by
the function, the CFC won't be running on a remote server. It'll be
running on the same server as the other code, and the Request scope
will be available and shared across all files used to respond to that
request. You can tell it'll be running on the same server because the
ACCESS attribute is set to "public", not "remote".

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instructio

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332597
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to