Element MAINDSN is undefined in REQUEST.

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, http://dev.mywebsite.com/customers/index.cfm?fuseaction=newsletter  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 (
#form.name#, #form.email#
)
</cfquery>
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, http://dev.mywebsite.com//customers/index.cfm?fuseaction=newuser, which goes to act_add_member,
 has this code, and it works:

<CFQUERY DATASOURCE="#request.maindsn#" NAME="insert">
                        INSERT INTO users
                        (
                              email,
                              password,
                              first_name,
                              last_name,
                              last_ip,
                              
                              active
                        )
                        VALUES
                        (
                              <CFIF #isdefined("no_email")#>
                                    'noemail@adhost.com',
                              <CFELSE>
                                    '#Trim(attributes.email)#',
                              </CFIF>                              
                              '#Trim(attributes.password)#',
                              '#Trim(attributes.firstname)#',
                              '#Trim(attributes.lastname)#',
                              '#CGI.REMOTE_ADDR#',
                              
                              1
                        )
                        
                        SELECT @@IDENTITY AS 'id'
                  </CFQUERY>

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!
mel150Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wytcomCommented:
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...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PluckaCommented:
mel150,

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

Regards
Plucka
0
PluckaCommented:
mel150,

If you want something to survive, like a DSN.

Use the application or session scope.

Regards
Plucka
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

zomega42Commented:
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.
0
SidFishesCommented:
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.
0
mel150Author Commented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.