That too, but the problem here looks to be the fact he is asking for
application.dsn but never setting it.







"This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant,
Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions." 
Visit our website at http://www.reedexpo.com

-----Original Message-----
From: Doug Brown
To: CF-Talk
Sent: Sat Nov 11 15:33:24 2006
Subject: Re: More DSN Troubles

WEll Jason, you are setting your Dsn twice in your application. first you
are setting it in the application scope and then you are setting it in the
request scope. You only need to set your datasource once and choose between
the application or request scope.

IE:

<cfset application.datasource = "myDsn">

and later

<cfset request.datasource = "myDsn">



Regards,


Doug


----- Original Message ----- 
From: "Jason T. Slack" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Saturday, November 11, 2006 7:55 AM
Subject: More DSN Troubles


> I have an application.cfc that looks like:
>
> <!--- Application.cfm --->
> <cfcomponent output="false">
>
>    <cfset THIS.name = "webPOS">
>
>    <cffunction name="onApplicationStart" returnType="boolean"
> output="false">
>      <!--- When did the application start? --->
>      <cfset APPLICATION.appStarted = now()>
>
> <cfset application.dataSource = "MyDSN">
>
>      <cfreturn true>
>    </cffunction>
>
>    <cffunction name="onApplicationEnd" returnType="void" output="false">
>      <cfargument name="appScope" required="true">
>
>      <!--- Log how many minutes the application stayed alive --->
>      <cflog file="#THIS.name#" text="App ended after #dateDiff
> ('n',ARGUMENTS.appScope.appStarted,now())# minutes.">
>
>    </cffunction>
>
>    <cffunction name="onRequestStart" returnType="boolean" output="true">
>      <!--- Any variables set here can be used by all our pages --->
>      <cfset request.dataSource = "MyDSN">
>      <cfset request.companyName = "Computer Outlet">
>
>      <cfreturn true>
>    </cffunction>
>
>    <cffunction name="onRequestEnd" returnType="void" output="true">
>
>    </cffunction>
>
> </cfcomponent>
>
> And I can calling:
>
> <cfquery name="ckCreds" datasource="#application.dsn#">
> SELECT LocationName FROM
>       WHERE LocationID = <Cfqueryparam cfsqltype="cf_sql_varchar"
> value="#form.user#">
>          AND LocationPassword = <cfqueryparam cfsqltype="cf_sql_varchar"
> value="#form.password#">
> </cfquery>
>
> <cfif ckCreds.recordCount EQ 1>
>     <!--- successful login --->
> <cflocation url="main.cfm" />
> <cfelse>
>     <!--- login failed --->
>     <cflocation url="index.cfm" />
> </cfif>
>
>
> but I get an error that states:
>
>   Element DSN is undefined in APPLICATION.
>
> I dont see why, can anyone point it out?
>
> Thanks,
>
> -Jason
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:260015
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to