Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variables

Status
Not open for further replies.

fortage

MIS
Joined
Jun 15, 2000
Messages
329
Location
US
I have an include file with an variable(CompanyTest) set to true if needed. In the asp page(vbscript) there is a session variable with the name of the company of the user logged on. I'm trying to do something like this
if session("Company") & "Test" = true then
do something
end if

session("Company") & "Test" together is the name of the variable I set to true in the include file. I appears as thought the if statement is just testing if the string is true as opposed to the value of the varialble. How can I get this to work. Now I receive the error
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: "CompanyOneTest"]'
 
Check out this one: thread333-176827
You should be able to edit it to address your needs I guess...

Code:
<%
session(&quot;CompanyTest&quot;) = TRUE
strStmnt = &quot;If session(&quot;&quot;company&quot; & &quot;test&quot;&quot;) = TRUE Then response.write &quot;&quot;yip&quot;&quot;&quot; 
response.write strStmnt & &quot;<br>&quot;
EXECUTE strStmnt
%>
This is not a bug - it's an undocumented feature...
;-)
 
Please note that strStmnt = .... &quot;&quot;yip&quot;&quot;&quot; all goes on one line... This is not a bug - it's an undocumented feature...
;-)
 
Actually the variable set in the include file is not a session variable. How could it be accomplished this way??
 
I'm fairly new to ASP, so forgive me in advance if this is not the best way to doit, but I just had something similar yesterday that I solved by using eval() to get the value:

e.g:

if eval(session(&quot;Company&quot;) & &quot;Test&quot;) = true then
do something
end if

HTH,
Tim P.
 
I thought about it but dismissed the idea of using EVAL(). Nice catch!

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top