Wierd VBScript comparison

They have: 222 posts

Joined: Sep 1999

I have an If statement where the condition is whether or not two variables are equal to each other. Variable A is a number taken from Request.QueryString and variable B is the size of an array found via (UBound(arrayname) - 1).

The wierd thing is that even when they're both the same number, the condition doesn't return true. I have response.write print both values to the screen and they're both the same number.

Is there a problem with them being different data types or something?

strPhoto = Request.QueryString("photo")

If strPhoto <> (UBound(photoshoot) - 1) Then
response.write "<a href='/photos.asp?album=" & strAlbum & "&photo=" & strPhoto + 1 & "' style='text-decoration: none'>"
End If
'

chrishirst's picture

He has: 379 posts

Joined: Apr 2005

a querystring parameter is returned as a string

so strPhoto = cint(Request.QueryString("photo"))'

They have: 222 posts

Joined: Sep 1999

That worked, thanks Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.