Now this is something that really bugs me and I have never managed to
get working with CFCs.

 

What I have is a cfc like this:

 

<cfcomponent name="QRY_financial" displayname="financial stuff"
hint="get common financial data">

        <cfproperty name="dsn" displayname="datasource" hint="the
datasource name" type="string" />
        
        <cffunction name="init" access="public" output="false"
returntype="void">
               <cfargument name="dsn" type="string" required="true">
               <cfscript>
                      setDsn(arguments.dsn);
               </cfscript>
        </cffunction>

        <cffunction name="getDsn" access="public" output="false"
returntype="string">
               <cfreturn dsn />
        </cffunction>

        <cffunction name="setDsn" access="public" output="false"
returntype="void">
               <cfargument name="dsn" type="string" required="true" />
               <cfset dsn = arguments.dsn />
               <cfreturn />
        </cffunction>

......more stuff

 

 

Which I think I should be able to call like this as I have seen all over
the web.

<cfset finObj =
createObject("component","queries.QRY_financial").init(myDsn)>

<cfdump var="#finObj.getDsn()#">

 

But when I do this I get an error from the Cfdump that:

            Variable finObj is undefined

 

Now I have tried it a number of ways, without the specific init function
and calling the setDsn like this

<cfset finObj =
createObject("component","queries.QRY_financial").setDsn(myDsn)>

 

No joy here just the same thing.  I feel that I am missing out on
something fundamental here, can someone give me a tip or a hint as to
what I am doing wrong.

 

Thanks for reading.

 

Cheers

Martin 




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265785
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to