Solved

syntax error on ASP ?

Posted on 2016-08-09
6
42 Views
Last Modified: 2016-08-09
I have two session variables and I want to display region A if the value of both is the same
And if the value of both is differnent then display region B

Somehow I am getting an error, I checked the value for both and both sessions have value =  31809

I get an error on the first line of the code below:

<% If Session("QnrUserId") = Session("Qnrmainuserid") Then %>
REGIONA
<% End If ' %>
<% If Session("QnrUserId") <> Session("Qnrmainuserid") Then %>
REGION B
<% End If ' %>

Open in new window


I am not sure what the problem is with the syntax if any. I get the following error:

Microsoft VBScript runtime error '800a000d'

Type mismatch

/bluedot/questionnaire/qnr_08.asp, line 190 

Open in new window


line 190 is the first line on the code above.
0
Comment
Question by:amucinobluedot
  • 3
  • 3
6 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 41748793
which of those lines is line 190?

anyhow, what about using "else" in this context?

<% If Session("QnrUserId") = Session("Qnrmainuserid") Then %>
REGIONA
<% Else  %>
REGION B
<% End If %>

Open in new window

I also notice some trailing quotes (after end if) in the posted code, that might also be the issue
what are the values of those session values?
0
 

Author Comment

by:amucinobluedot
ID: 41748794
As I mentioned, the first line is line 190

This is line 190:  <% If Session("QnrUserId") = Session("Qnrmainuserid") Then %>

I am not sure why even with the else I get the error:

Microsoft VBScript runtime error '800a000d'

Type mismatch

/bluedot/questionnaire/qnr_08.asp, line 190

Both sessions exist and both have the same numeric value

If I display the value on the page I get this:

qnruserid = 31809
qnrmainuserid = 31809
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 41748803
please output the typename(Session("QnrUserId") ) and typename(Session("Qnrmainuserid") ) for debugging. at some point, it must be different data types, or another line of code, otherwise the message would not make any sense...
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:amucinobluedot
ID: 41748813
I understand and if you read above that is what I did, both have the same value  =  31809
Is it possible the problem is actually on a different line ?
0
 

Author Closing Comment

by:amucinobluedot
ID: 41748834
I will use a work around. for some reason if I log out then log in the page works fine, but not if I create the user and go to that page directly.
Thanks for the 'else' tho  :)
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 41749123
then it was likely null values / nothing objects ...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Is there a canned solution for a custom genealogy website 2 79
WIX Redirect 1 38
app server have enough resources... 2 21
REReplaceNoCase help 1 13
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

914 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

16 Experts available now in Live!

Get 1:1 Help Now