This also works fine, I just can't do it in a single call, I know it is only 2
lines but I quite fancy doing it like this and it gets to me when something
does not work as I feel it should.
This also works
<cfset finObj = createObject("component","queries.QRY_financial")>
<cfset t = finObj.init(myDsn)>
<cfdump var="#finObj.getDsn()#">
I am running 7.01
>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:265787
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4