?
Solved

Element MAINDSN is undefined in REQUEST.

Posted on 2006-04-14
6
Medium Priority
?
520 Views
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, 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!
0
Comment
Question by:mel150
6 Comments
 
LVL 7

Accepted Solution

by:
wytcom earned 2000 total points
ID: 16457900
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
 
LVL 18

Expert Comment

by:Plucka
ID: 16458155
mel150,

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

Regards
Plucka
0
 
LVL 18

Expert Comment

by:Plucka
ID: 16458160
mel150,

If you want something to survive, like a DSN.

Use the application or session scope.

Regards
Plucka
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
LVL 2

Expert Comment

by:zomega42
ID: 16458618
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
 
LVL 36

Expert Comment

by:SidFishes
ID: 16458743
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
 

Author Comment

by:mel150
ID: 16460310
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

807 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