It tells me that variables.dsn is not defined.

I modified it so that I am just storing the application variable <cfset
application.dataSource = "Progress" /> in my application.cfm file then
in my .cfm page I call the init() method in the mailer.cfc passing
application.dataSource.

So my .cfm page looks like:
<cfset variables.getOrders = createObject("component",
"mailer").init(application.datasource).ordersShipped() />

That works but I'm not sure if that is the best way to do it.

Thanks,
Ben

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Brian Kotek
Sent: Friday, April 09, 2004 11:00 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Access to Application variables

Are you getting a specific error message?

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Ben Densmore
> Sent: Friday, April 09, 2004 10:51 AM
> To: [EMAIL PROTECTED]
> Subject: [CFCDev] Access to Application variables
> 
> 
> I'm trying to store my Datasource names in my application.cfm 
> file and call them from a cfc but for some reason it doesn't 
> seem to work. Can someone tell me what might be wrong here:
> 
> Application.cfm:
> <cfset application.dataSource = "Progress" />
> <cfset application.dsn = CreateObject("component",
> "mailer").init(application.dataSource) />
> 
> mailer.cfc:
> <cfcomponent>
>       <cffunction name="init" output="false" access="public" 
> returntype="mailer">
>               <cfargument name="dsn" type="string" required="true">
>               
>               <cfset variables.dsn = arguments.dsn />
> 
>               <cfreturn this />
>       </cffunction>
> 
> 
>    <cffunction name="ordersShipped" access="public" 
> output="false" returntype="query">
>       <cfset var getOrdersShipped = 0 />
>       
>       <cfquery name="getOrdersShipped" datasource="#variables.dsn#">
>         Select OrderDtl.PartNum, Customer.Name, CustCnt.Name, 
> CustCnt.EmailAddress, OrderHed.Character05, 
> OrderHed.Number01, ShipHead.PackNum
>         From
>         Pub.OrderDtl, Pub.Customer, Pub.CustCnt, 
> Pub.OrderHed, Pub.ShipHead
>         Where
>         ShipHead.Company = 'HMC'
>         And ShipHead.ReadyToInvoice = 'yes'
>         And ShipHead.ShipDate = '#DateFormat(Now() - 14, "MM/DD/YY")#'
>         And Orderhed.Company = ShipHead.Company
>         And OrderHed.OrderNum = ShipHead.OrderNum
>         And OrderHed.OpenOrder = 'no'
>         And OrderHed.number01 != 1
>         And OrderDtl.Company = OrderHed.Company
>         And OrderDtl.OrderNum = OrderHed.OrderNum
>         And Customer.Company = OrderHed.Company
>         And Customer.CustNum = OrderHed.CustNum
>         And CustCnt.Company = Customer.Company
>         And CustCnt.CustNum = Customer.CustNum
>         And CustCnt.ShipToNum = ''
>         And CustCnt.ConNum = OrderHed.PrcCntNum
>         Order By ShipHead.PackNum
>       
>       </cfquery>
>    
>    </cffunction>
> 
> </cfcomponent>
> 
> Thanks,
> Ben
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
> in the message of the email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
> 
> An archive of the CFCDev list is available at 
> www.mail-archive.com/[EMAIL PROTECTED]
> 

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to