How are you calling the mailer CFC?  You should be doing it like this:

<cfset application.dsn.ordersShipped() />

I'm not sure why you named the variable storing it "dsn", but your code
should work as-is, if you're calling it like that.

Cheers,
barneyb 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Ben Densmore
> Sent: Friday, April 09, 2004 7: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]

Reply via email to