简体   繁体   English

iis7,经典asp; 类型不匹配错误

[英]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. 我已经在Windows 7和IIS 7上安装了本地服务器,用于我正在处理的经典ASP VBS网站。

A page gives me a "type mismatch" error. 一页显示“类型不匹配”错误。 This doesn't happen with the original server (Windows 2008, IIS 7) 原始服务器(Windows 2008,IIS 7)不会发生这种情况

related code: 相关代码:

if myRS("age") = 10 then
  • The field value is an empty string, checked with a debugger, also the error states 'string' 字段值是一个空字符串,已通过调试器检查,并且错误状态为“字符串”
  • The ASP file, database & the data are exact copies of the production site ASP文件,数据库和数据是生产站点的精确副本
  • No error resuming in both the public and the local sites. 在公共站点和本地站点中都不会恢复错误。
  • The production server is MS-SQL 2008 R2 web edition, where the local one is Express Edition. 生产服务器是MS-SQL 2008 R2 Web版,本地服务器是Express Edition。

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? 我认为比较是通过变体类型进行的,因此应该自动评估子类型而没有错误?

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. 我的猜测是您的生产服务器已经被“修复”以允许它,而您的本地服务器设置从未经历过“ ..fix ..”的需要。

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 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. 您已经使用CreateObject创建了记录集/ ado对象,并且受到这种担忧的影响,该担忧导致Microsoft将它们默认设置为即开即用。

Read a bit more here: 在这里阅读更多内容:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;287422 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. 虽然..如果您只是想让它工作,那么您可以阅读第一个链接。

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. 例如,它是一个空字符串,一个空白字符串还是null。

Try rewriting so that you can log the value of myRS("age"). 尝试重写,以便您可以记录myRS(“ age”)的值。

I was not aware of the server configuration you can make to fix this that Nonym mentioned. 我不知道您可以用来解决Nonym提到的服务器配置。 My suggestion would have been to just update the code to explicitly call the desired property instead of letting it be inferred; 我的建议是只更新代码以显式调用所需的属性,而不是让其推断出来。 eg, 例如,

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! 祝你好运!

Seems like a ADO recordset issue. 似乎是ADO记录集问题。 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). 尝试输出myRS(“ age”)值,如果没有返回任何值或错误,则尝试更改连接字符串中的sql驱动程序,甚至可能使用CStr(myRS(“ age”))= CStr(10)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM