Solved

syntax error on ASP ?

Posted on 2016-08-09
6
39 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

706 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

18 Experts available now in Live!

Get 1:1 Help Now