say i have the cfc
<!--- get agents name --->
<cfcomponent>
<cffunction name="mainpage" access="public" returntype="query" hint="get mainpage info">
<!--- set site dsn connection --->
<cfset dsn = "whenever">
<cfset un = "whoever">
<cfset pw = "whatever">
<cfquery name="qMP" datasource="#dsn#" username="#un#" password="#pw#">
SELECT *
FROM mainpage
</cfquery>
<cfreturn qMP>
</cffunction>
</cfcomponent>
and then the object call from the application.cfm template
<cfobject name="amainPage" component="components.mainpage">
how would it be put in?
thanks :)
---------- Original Message ----------------------------------
From: Barney Boisvert <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date: Wed, 22 Sep 2004 18:17:07 -0700
>What scope are you setting them into? Each CFC instance has it's own
>'variables' scope, but it can reference any of the shared scopes (app,
>session, server) and any of the request scopes (url, form, request,
>client).
>
>However, before you change that, you're almost always better off
>passing in values to your CFCs (with the init() method), rather than
>letting your CFCs reference any external variables. When you
>instantiate your CFC, just pass along your DSN and whatever else, and
>store it inside the CFC. That way you stick with only having a single
>place to record the data (Application.cfm), and you don't have your
>CFCs referencing external variables anywhere.
>
>cheers,
>barneyb
>
>
>On Wed, 22 Sep 2004 21:09:43 -0400, dave <[EMAIL PROTECTED]> wrote:
>> i have never seen an explanation for this and maybe i am on crack again but.....
>>
>> say i have the db connection variables in cfc
>> why wont they read from the Application.cfm file?
>>
>> or will they? when i set it up to read it that way it fails
>>
>> kinda a PITA to go into every cfc to do it
>>
>>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

