- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个功能(见下文),它运行良好。我最近将我的代码移到了另一台服务器上,但我没有更改其中的任何内容。它无法在新服务器上运行。
Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'Mid'
/calculate.asp, line 416
当我检查第 416 行时,我得到了这个:
Dim result3: result3 = Mid(o3.responseText, Basla3, Bitir3)
这是完整的功能:
<%
Function xyz()
Dim o3: Set o3 = Server.CreateObject("MSXML2.ServerXMLHTTP")
Dim o_date3: o_date3 = split(EndingDate, ".")
Dim s_date3
If (Len(o_date3(2)) = 4) Then
s_date3 = o_date3(2)
Else
s_date3 = "20" & o_date3(2)
End If
If (Len(o_date3(1)) = 2) Then
s_date3 = s_date3 & o_date3(1)
Else
s_date3 = s_date3 & "0" & o_date3(1)
End If
If (Len(o_date3(0)) = 2) Then
s_date3 = s_date3 & o_date3(0)
Else
s_date3 = s_date3 & "0" & o_date3(0)
End If
Dim s3: s3 = "<soapenv:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:urn=""urn:AntTransferWSIntf-IAntTransferWS""><soapenv:Header/><soapenv:Body><urn:EURCurrency soapenv:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/""><DateStr xsi:type=""xsd:string"">" + s_date3 + "</DateStr></urn:EURCurrency></soapenv:Body></soapenv:Envelope>"
o3.Open "POST", serviceUrl, False
o3.setRequestHeader "Content-Type", "text/xml"
o3.setRequestHeader "Connection", "close"
o3.setRequestHeader "SOAPAction", " "
o3.send s3
Dim hataVarMiBasla3: hataVarMiBasla3 = (InStr(1, o3.responseText, "<faultstring>", vbTextCompare)) + 13
If (hataVarMiBasla3 > 13) Then
Dim hataVarMiBitir3: hataVarMiBitir3 = (InStr(1, o3.responseText, "</faultstring>", vbTextCompare)) - hataVarMiBasla3
Dim hata3: hata3 = Mid(o3.responseText, hataVarMiBasla3, hataVarMiBitir3)
KurGetir = hata3
Else
Dim Basla3: Basla3 = (InStr(1, o3.responseText, """xsd:double"">", vbTextCompare)) + 13
Dim Bitir3: Bitir3 = (InStr(1, o3.responseText, "</return>", vbTextCompare)) - Basla3
Dim result3: result3 = Mid(o3.responseText, Basla3, Bitir3)
xyz = CDbl(Replace(result3, ".", mstrComma))
End If
Set o3 = Nothing
End Function
%>
为什么我会收到这个错误?
最佳答案
Mid(string, start[, length])
不是官方引用,但根据我的经验,如果
查看错误行和相关的。
Dim Basla3: Basla3 = (InStr(1, o3.responseText, """xsd:double"">", vbTextCompare)) + 13
Dim Bitir3: Bitir3 = (InStr(1, o3.responseText, "</return>", vbTextCompare)) - Basla3
Dim result3: result3 = Mid(o3.responseText, Basla3, Bitir3)
假设 o3.responseText
为空,因为您的代码不检查响应是否为空。
Basla3
根据 InStr() + 13
不能小于 13 ,所以这不是问题。
但是看起来像 Bitir3
根据 InStr() - Basla3
可以小于零(Basla3 评估为 13)。
继续假设,(InStr(1, o3.responseText, "</return>", vbTextCompare))
评估为 0
,然后使用 - Basla3
它将被评估为 -13
.
多田! 规则 2 违反,长度不能小于零。
您的代码的问题是,没有检查响应长度或响应状态。如果响应为空,请考虑以下事项:
简而言之,您应该优化代码并确保有xml响应。
至少使用类似的东西:
o3.Send
If o3.readyState = 4 And o3.status = 200 Then
If Len(o3.responseText) > 0 Then
'response is ready to parse
Else
'response status is ok but empty
End If
Else
'request failed
End If
顺便说一句,由于您的请求是一个肥皂电话,我强烈建议您通过使用 DomDocument 等解析 xml 响应来完成这项工作。
替换小数点,使用 Mid & InStr
配对检查节点存在也是麻烦和不好的做法。
关于asp-classic - 无效的过程调用或参数 : 'Mid' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18780142/
我想知道是否有人可以帮助我,因为我对我认为导致简单错误的简单原因视而不见。 我有这个代码: doRound1(x1) denom1 = 5 y1 = denom1 - x1 mod deno
我有以下代码,注释详细说明了会发生什么: averageNum = myArray2(0) 'assign variable response.write(TypeName(averageNum)&"
我有以下脚本,它在本地运行良好(Windows 10 IIS、Windows 2003 Server),但不适用于我们的托管服务器(Windows 2003 Server)。任何超过 4mb 的下载都
ASP Classic 是否具有等同于 PHP 的“包含一次”功能的功能? 最佳答案 我知道这是一个古老的话题,但我想如果有人感兴趣,我会加上我的两分钱。 我编写了一个函数,它完全符合您的要求:无论调
我在Windows 7中运行IIS 7.5,并且已经进入“打开或关闭Windows功能”并在“Internet信息服务/万维网服务/应用程序开发功能”中启用了ASP。一旦做完,我开始收到一个HTTP
我正在尝试从 MS Access 数据库创建一个 ID(主键和自动增量)以用作登录密码。但我收到此错误: Microsoft OLE DB Provider for ODBC Drivers erro
我已经为 Classic ASP(VBScript) + firephp 编写了一个开源调试类,想知道是否可以获取传递给函数的变量的名称?我进行了搜索,但似乎找不到任何技巧来执行此操作。 例子 代码:
我正在尝试从 MS Access 数据库中创建一个 ID(主键和自动增量)以用作登录密码。但是我收到了这个错误: Microsoft OLE DB Provider for ODBC Drivers
我有一个结帐表格,其中产品的数量可以是“n”。那么我如何知道表单中有多少输入字段并从中获取输入呢? 谢谢 最佳答案 如果它是一组单个控件 - 比如说代表项目的可变数量的复选框 - 解决方案非常简单。对
我刚刚审查了一些旧代码并发现了以下内容(在 foo.asp 中): Const ASP_FILENAME = "foo.asp" ' TODO: Update this to the name of
关注 my last question有谁知道如何在经典 ASP 的应用程序范围内使用字典对象?您不能使用 Scripting.Dictionary - 如果您尝试使用,您将看到类似以下内容: App
我的意思是,像 php'h 包括... 就像是 my_file_to_be_included = "include_me.asp" --> 就我目前所见,有几种选择,但每一种都有某种缺点......
我在哪里可以找到“经典”ASP 代码的编辑器? 最佳答案 如果我要进行大量更改,我总是使用 VS2008(支持智能感知、高亮显示和来自 SP1 的调试),Notepad2对于快速(没有智能感知,只有突
例如,我如何运行下面的 me.test? myvar = 'test' me.myvar ASP 查找方法“myvar”但没有找到。在 PHP 中我可以简单地说 $me->$myvar 但 ASP 的
这是要点: 我有一个我想用asp打的电话,我不关心响应。我只想触发调用,我不希望页面等待响应。根据文档,它应该看起来像这样: dim xmlhttp : set xmlhttp = Server.Cr
示例代码: Dim myObject Set myObject = JSON.parse(someJsonResponseFromTheServer) myFunction(myObject.s
据我所知,VBScript/Classic ASP 中唯一的预处理指令是#include。我不知道这是否是正式名称,但我基本上是在寻找可以在通用 VBScript 之前执行代码或其他指令的代码。 VB
据我所知,VBScript/Classic ASP 中唯一的预处理指令是#include。我不知道这是否是正式名称,但我基本上是在寻找可以在通用 VBScript 之前执行代码或其他指令的代码。 VB
我必须维护一个 ASP 3.0 网站... 我想保护sql语句。 我可以使用此代码保护的选择语句: set cmd = Server.createObject("adodb.command") cmd
我正在使用 WebMatrix 中托管的经典 ASP Web 应用程序。有没有办法调试托管在 WebMatrix 中的网站? 最佳答案 WebMatrix 通过调试工具提供很少(没有)。您可以 Res
我是一名优秀的程序员,十分优秀!