Skip to main content
Known Participant
September 9, 2008
Question

Datasrouce set in Application cfc

  • September 9, 2008
  • 1 reply
  • 856 views
I want to set a dataSource in the Application.cfc and then just refer to it in the other pages on the site. How do I set this up? thanks.
This topic has been closed for replies.

1 reply

Inspiring
September 9, 2008
Set an application variable in the onApplicationStart method.
Known Participant
September 9, 2008
SO something like this
<cffunction name="onRequestStart" returntype="boolean" output="yes">
<CFSET request.dataSource = "enroll">
<cfreturn true>
</cffunction>

Then how do I use it on the other pages?
Inspiring
September 9, 2008
TheScarecrow wrote:
> SO something like this
> <cffunction name="onRequestStart" returntype="boolean" output="yes">
> <CFSET request.dataSource = "enroll">
> <cfreturn true>
> </cffunction>
>
> Then how do I use it on the other pages?
>

OnRequestStart is invoked at the start of every request. So it would be
invoked at least once per page, thus setting that variable for you.