Quote:
|
Originally Posted by Morgoth
strSport = Int(Request.QueryString("sport"))
|
That would produce a type mismatch error if "sport" is not a number. Since "sport" is a querystring, the user can easily change its value and your page will not be able to handle the error. You should check first if its numeric by using the IsNumeric() function.
But the real problem is not actually the sport querystring not being an integer. As in any loosely-typed languages like VBScript, comparing 1="1" will result to True. The same is true for Javascript (you have to use strict equality operator === to make strict comparison)
I remember I also experienced that weird error for comparing recordset field values to a variable or expression even though outputting them will result to same values. The solution is to store first the recordset field value to a variable before doing the comparison. I forgot the exact reason behind that.
dim qsSport, rsSport1, rsSport2, rsSport3, whichsportfield
qsSport = Request.Querystring("sport")
rsSport1 = rs.Fields("Sport1")
rsSport2 = rs.Fields("Sport2")
rsSport3 = rs.Fields("Sport3")
if rsSport1=qsSport then whichsportfield = 1
if rsSport2=qsSport then whichsportfield = 2
if rsSport3=qsSport then whichsportfield = 3