Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7580929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:02:45+00:00 2026-05-30T18:02:45+00:00

I have a somewhat unnerving problem when using constant values. I have a simple

  • 0

I have a somewhat unnerving problem when using constant values. I have a simple page called “test.asp” which sets a variable to a constant and then to a querystring value (if it exists). Then a select case checks if the variable matches the constant and outputs a message “matched”. The problem is that asp does not recognise when the querystring value is the same as the constant.
I have run 2 attempts, “test.asp” and “test.asp?SortField=1”. The first attempt runs as expected but the second attempt reports that 1 is not the same as 1.
The code for this page is as follows.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<head></head>
<body>

<%
const cSortFielda = 1
dim vSortField

vSortField = cSortFielda
if not isempty(Request("SortField")) then
    vSortField = Request("SortField")
    end if

select case vSortField
    case cSortFielda
        response.write "matched</br>"

    case else
        response.write "failed</br>"
        response.write "vSortField = " & vSortField & "(" & asc(vSortField) & ") </br>"
        response.write "cSortFielda = " & cSortFielda & "(" & asc(cSortFielda) & ") </br>"
        response.write "vSortField = cSortFielda is " & (vSortField = cSortFielda) & "</br>"

        end select
%>

</body>
</html>

Am I missing something blatantly obvious or is asp classic at fault?

Thank you for any assistance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:02:46+00:00Added an answer on May 30, 2026 at 6:02 pm

    You’re comparing a string with a number. You need to make sure they are consistent. So either change this line:

    const cSortFielda = 1
    

    To:

    const cSortFielda = "1"
    

    Or change this line:

    vSortField = Request("SortField")
    

    To:

    vSortField = CLng(Request("SortField"))
    

    The first example compares string to string, and the second example compares number to number.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a somewhat stupid problem because it's supposed to be utterly simple ...
I have somewhat simple problem with my Flash projects. I've installed Flash CS5, created
I have a somewhat simple Client/Server solution running over C# remoting (System.Runtime.Remoting). The MarshalByRef
I have a somewhat-long-running stored procedure being called from a PB application. I want
I have somewhat of a problem. We have a centralized interface engine that will
I have a somewhat simple game that I'm making and now that I'm testing
I have a somewhat complex query with multiple (nested) sub-queries, which I want to
I have a somewhat unusual problem. In my app, I am shadowing a UIImageView
I have somewhat of a problem. My old webserver (windows 2003) have been replaced,
I have a somewhat grouping system which all the elements between two divs are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.