Solved

syntax error on ASP ?

Posted on 2016-08-09
6
58 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 143

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 143

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 143

Expert Comment

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

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

718 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