DarkWingDuck
DarkWingDuck

Reputation: 2128

iis7, classic asp; type mismatch error

I've setup a local server on Windows 7 with IIS 7, for a classic ASP VBS site I'm working on.

A page gives me a "type mismatch" error. This doesn't happen with the original server (Windows 2008, IIS 7)

related code:

if myRS("age") = 10 then

Now I know the code is terribly written. But how can the local server gives such an error and the public server does not? I think comparisons are made through variant type, so subtypes should be automatically evaluated with no errors?

Upvotes: 0

Views: 4037

Answers (4)

avakharia
avakharia

Reputation: 206

Seems like a ADO recordset issue. Try outputting myRS("age") value and if it return nothing or errors out, then try changing the sql driver in connection string or possibly even use CStr(myRS("age")) = CStr(10).

Upvotes: 0

Funka
Funka

Reputation: 4278

I was not aware of the server configuration you can make to fix this that Nonym mentioned. My suggestion would have been to just update the code to explicitly call the desired property instead of letting it be inferred; e.g.,

Change this:

if myRS("age") = 10 then

Into this:

if myRS("age").Value = 10 then

This can also have other advantages if I recall correctly, though no specific examples come to mind why at the moment. Best of luck!

Upvotes: 0

Nonym
Nonym

Reputation: 6299

It's most likely caused by an "..intrinsic properties.." issue. My guess is that your production server had already been "fixed" to allow it, and your local server set up has never before experienced the need to "..fix.." this.

You can read more here:

http://blogs.msdn.com/b/distributedservices/archive/2010/04/28/iis-intrinsic-properties-are-disabled-by-default-on-windows-2008-and-windows-2008-r2.aspx

You've used CreateObject to create your recordset/ado objects, and that's affected by this concern which caused Microsoft to disable them as default, out of the box configurations.

Read a bit more here:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;287422

Although.. if you simply want it to work, then you can read the first link.

Upvotes: 3

Shiraz Bhaiji
Shiraz Bhaiji

Reputation: 65471

It could be different data sources or drivers, such that data that looks the same is slightly different.

For example is it an empty string, a blank string or null.

Try rewriting so that you can log the value of myRS("age").

Upvotes: 0

Related Questions