Type Mismatch Error in ASP Classic

In ASP Classic, the warning type mismatch is a general error that happens when you try to stuff one type of value into a variable of another type.

Let’s say you are working with numbers, adding and subtracting them. You’re working with

LowVal
HighVal
NewVal

And then at some point you say something like

HighVal = “XYZZY”

Your HighVal variable is no longer a number. Now it’s a string.

The next time you try to do a numeric operation on it, your operations are soon going to fail with a type mismatch error.

This is where we get into one of the standard techniques of ASP Classic debugging.

The easiest way to figure out where you went wrong is to do a response.write of each value along the path. Yup, put them all in. Watch it step through. That way you can see exactly what each value is set to. You’ll soon figure out which one is getting in a “bad” value.

ASP Error Listing and Solutions