ASP Archives

Improved Integer and Numeric Conversion in ASP

The following function is for those of you who have run across this error in ASP when trying to convert a non-numeric value to an integer:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'CInt'

This function will take anything and convert it to an integer. If the value being passed to it is not an integer, the function will return a 0 in its place.

Function IntConverter (byVal Input)

if IsNull (Input) or Input = "" or not IsNumeric (Input) then
IntConverter = 0
else
IntConverter = CInt (Input)
end if

end function

For those of you who wish to convert anything to a decimal number (not necessarily an integer), this function should do it for you:


Function DblConverter (byVal Input)

if IsNull (Input) or Input = "" or not IsNumeric (Input) then
DblConverter = 0
else
DblConverter = CDbl (Input)
end if

end function

If this helps anyone, could you please let me know? Thanks.


ASP 301 Redirect Code (that actually works)

I see this question asked quite a bit from people wishing to learn more about SEO and who use ASP to create their pages, as I do. As a result, I’ve created this post to provide others with the correct, working ASP code for a 301 redirect.

Read the rest of this entry »


  • Pages:
  • 1