can some one tell me how to call the dsn from other method within the same cfc.
this getDSN method return me the correct dsn that i declared from application.cfm.
<cffunction name="GetDSN" access="public" output="false" hint="Gets the DSN">
<cfargument name="dsn" required="yes">
<cfreturn this />
how can i get the dsn from above method. What i have is not working..........
<cffunction name="findDupicate" output="no" access="public" returntype="query">
<cfargument name="form" required="yes" type="struct">
<cfquery name="check_duplicate" datasource="#GetDSN#">
WHERE voucherNo= <cfqueryparam value="#arguments.form.voucher#" cfsqltype="cf_sql_varchar" />
Two things that immediately spring to mind.
getDsn() is misnamed, or does the wrong thing. It doesn't return a DSN, it returns the entire object (return this).
I your CFQUERY tag you're not calling getDsn(), you're just using it as a value, eg: "getDsn" is a reference to the method itself, but "getDsn()" is actually CALLING the method.
Oh a third thing: something called getDsn() would not normally take an argument that is the very thing it is supposedly getting. IE: why is getDsn() taking an argument of dsn? It should be RETURNING the DSN name, not having it passed into it.
the reason i have have argument because it was set in application.cfm page.
<cfobject type="component" name="request.voucher" component="#request.cfc#.voucher">
<cfset variables.dsn = request.voucher.GetDSN(#DBSource#) />
i have try calling getDSN(), but got this and don't know what to pass it in?