Solved

syntax error on ASP ?

Posted on 2016-08-09
6
45 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
The viewer will learn how to dynamically set the form action using jQuery.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

816 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

8 Experts available now in Live!

Get 1:1 Help Now