Hi there I'm making a CMS, and each page is referenced by ID. For instance, a URL might be: www.mydomain.com/index.asp?p=142 Code (markup): Now, it is possible to type in: www.mydomain.com/index.asp?p=abc Code (markup): and you get a big ugly error because the ID field in my database is an autonumber, so there are no delimiters, and the field doesn't accept text. Anyone know how to check if Request.Querystring("p") is an integer? Thanks in advance Dylan
Try this if you use VB.Net, else convert to C#: Dim theString As String = Request.Querystring("p") If IsNumeric(theString) Then Do Something Else Do Something Else End If
I know you already got an answer, however if you want to stick to classic ASP, the following should work: theVariable = Request.Querystring("p") If theVariable + 1 > 0 Then ' This is a number Else ' It would have returned -1, and we know that it's not a number End If