gpt4 book ai didi

asp-classic - 经典 ASP : I'm getting a type mismatch error when I shouldn't

转载 作者:行者123 更新时间:2023-12-04 02:05:57 26 4
gpt4 key购买 nike

我有一个将 HTML 编码的文本转换回 HTML 的功能。它正常工作得很好,但由于某种原因,我今天尝试在某些文本上使用它,并收到以下错误:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'UnChkString'

/manage/solutions_delete.asp, line 22

我正在使用此功能的行是:
<%= UnChkString(solution_desc) %>
solution_desc变量是:
&lt;p&gt;Here is a description of what this solution is all about.&lt;/p&gt;

数据库正在拉取的字段 solution_desc from 是一个文本字段。

我的 UnChkString 函数是:
Function UnChkString(string)
UnChkString = Replace(string,"[%]","%")
UnChkString = HTMLDecode(UnChkString)
End Function

HTMLDecode 函数是:
Function HTMLDecode(sText)
Dim I
sText = Replace(sText, "&amp;" , Chr(38))
sText = Replace(sText, "&amp;" , "&")
sText = Replace(sText, "&quot;", Chr(34))
sText = Replace(sText, "&rsquo;", Chr(39))
sText = Replace(sText, "&lt;" , Chr(60))
sText = Replace(sText, "&gt;" , Chr(62))
sText = Replace(sText, "&nbsp;", Chr(32))
For I = 1 to 255
sText = Replace(sText, "&#" & I & ";", Chr(I))
Next
HTMLDecode = sText
End Function

编辑

我什至试过:
<%= UnChkString(CStr(solution_desc)) %>

没有运气。

最佳答案

有时最好非常仔细地重新阅读错误。考虑这块 VBS:

 DoStuff("Hello World")

DoStuff没有定义,也没有 Option Explicit我得到:

Error: Type mismatch: 'DoStuff'



您的错误是: Type mismatch: 'UnChkString' .它没有提示传递的参数,它提示 UnChkString本身。我的猜测是你已经犯下了最基本的 VBScript 编程错误,你没有 Option Explicit在你的代码顶部。这是必须的。

由于不清楚您到目前为止发布的代码的原因,代码是 <%= UnChkString(solution_desc) %>正在执行脚本引擎没有功能 UnChkString ,因此您看到的错误。我怀疑包含 Option Explicit将揭示问题(以及强制您使用 Dim 所有变量)。

关于asp-classic - 经典 ASP : I'm getting a type mismatch error when I shouldn't,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9619278/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com