GetDSN from other method


hi,

 

can 1 tell me how call dsn other method within same cfc.

this getdsn method return me correct dsn declared application.cfm.

 

<cffunction name="getdsn" access="public"  output="false"    hint="gets dsn">

<cfargument name="dsn" required="yes">

    <cfreturn />

</cffunction>

 

how can dsn above method.  have not working..........

<cffunction name="finddupicate" output="no" access="public" returntype="query">

        <cfargument name="form" required="yes" type="struct">   

        <cfquery name="check_duplicate" datasource="#getdsn#">

        select voucherno

        voucher

        voucherno= <cfqueryparam value="#arguments.form.voucher#" cfsqltype="cf_sql_varchar" />

       

    </cfquery>

    <cfreturn check_duplicate>

    </cffunction>

 

thanks

two things spring mind.

 

getdsn() misnamed, or wrong thing.  doesn't return dsn, returns entire object (return this).

 

i cfquery tag you're not calling getdsn(), you're using value, eg: "getdsn" reference method itself, "getdsn()" calling method.

 

oh third thing: called getdsn() not take argument thing supposedly getting.  ie: why getdsn() taking argument of dsn?  should returning dsn name, not having passed it.

 

--

adam



More discussions in Getting Started


adobe

Comments