dcsimg
Strange behaviour in a Switch statement
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Nigel_Smith
Posted On:   Monday, March 17, 2003 05:46 PM

Please take a look at the two scenarios below. In each case the querystring contains : ?Target=Man This works: var Target = request.querystring ("Target"); var table1; // // This works : // if (Target=="Man") { table1= "tblManagers"; } else if (Target=="Rep") { table1= "tblReports"; } else if (Target=="Pee") { table1= "tblPeers"; } else { table1= "Unknown" } ]]>]]> But this does NOT work var Target = request.querystring ("Target"); var table2; switch (Target) { case "Man": table2= "tblManagers"; break; case "Rep": table2= "tblManagers"; break; case "Pee": table2= "tblManagers"; break; default: table2= "Unkno   More>>

Please take a look at the two scenarios below. In each case the

querystring contains : ?Target=Man


This works:

			




But this does NOT work


			




But with a line like : Target= "Man"; before the switch statement it works.


Can anybody shed any light on this?


Nigel    <<Less

Re: Strange behaviour in a Switch statement

Posted By:   Nitesh_Naveen  
Posted On:   Tuesday, March 18, 2003 01:48 AM

Check out the string you get from the request by putting some debug alerts. That is the only pae where the problem could be.
About | Sitemap | Contact