Element MAINDSN is undefined in REQUEST.

Posted on 2006-04-14
Last Modified: 2013-12-24
Hi- I am stymied, I'm trying to do a very simple thing, but I must be making a basic error somewhere. I have a page,  to allow customers to sign up for our newsletter. I want the form to enter their name and email in a table called newsletter. The form action="act_newsletter.cfm".

In act_newsletter.cfm, I have this simple code (trying to make it as simple as possible):
<cfquery datasource="#request.maindsn#" name ="insertemail">
INSERT INTO newsletter (name, email_address)
values (,
Thanks! You have been added to the mailing list!

 And I get the error, Element MAINDSN is undefined in REQUEST. I don't understand, for two reasons:

1. Another, much more complex form,, which goes to act_add_member,
 has this code, and it works:

<CFQUERY DATASOURCE="#request.maindsn#" NAME="insert">
                        INSERT INTO users
                              <CFIF #isdefined("no_email")#>
                        SELECT @@IDENTITY AS 'id'

and 2. App_local in this folder points to app_global, which points to app_server, which says, in part:

<cfset request.maindsn="mymagic">

 Could someone kindly help me out with this? Thanks so much!
Question by:mel150
    LVL 7

    Accepted Solution

    Since the problem is that the request.maindsn variable is undefined for your page, you need to track it down.
    To prove to yourself that that is really the problem try defining reqest.maindsn at the top of your action file.
    That should kill the problem and show that this error message is pointing directly to the real error.
    Perhaps there is a problem getting through the chain from App_local to app_global to app_server.
    Hope it helps...
    LVL 18

    Expert Comment


    Request variables don't pass from page to page, they only survive for the current page.

    LVL 18

    Expert Comment


    If you want something to survive, like a DSN.

    Use the application or session scope.

    LVL 2

    Expert Comment

    I just posted a comment in your previous question that answers this, take a look and if it doesn't answer your question let me know.
    LVL 36

    Expert Comment

    since you are using fusebox... request variables actually do persist

    you need to add a

    <cfset request.maindsn = "somedsn">

    in your fbx_settings.cfm file

    when any file in the framework is called fusebox parses the fbx_settings file and the request variable is set.

    Author Comment

    thanks to  all of you! Now I have a different issue, but the database is being called. If I can't solve this one, I'll open another question.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
    Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    6 Experts available now in Live!

    Get 1:1 Help Now