在 Windows 2012 上使用 IIS 8 用 VBScript 编写的问题 运行 经典 ASP
Issue running Classic ASP written in VBScript on Windows 2012 with IIS 8
这是一个非常特殊的问题。我安装了 2012 Server 运行 IIS 8,支持经典 ASP。我正在从表单构建一个逗号分隔的字符串。然后我从 table 中检索这个字符串并想用逗号分隔。
首先,当我构建字符串并将其提交给数据库(SQL Express 2014)时,即使没有 space,也会在每个逗号后添加一个 space在代码中。
其次,当我 return 字符串并尝试在逗号上拆分时,它什么也没做; ubound 方法 returns -1...出于测试目的,我手动构建了一个数组,它具有相同的行为。
构建 csv 字符串的代码:
If fieldName = "txt_EnvironmentType" then
strTempEnvCSV = strTempEnvCSV & fieldValue & ","
End If
拆分测试代码:
txtEnvironmentType = "This,Is,A,Test,String"
If txtEnvironmentType <> "" then
response.write(txtEnvironmentType)
array = split(txtEnvironmentType,",")
l = ubound(array)
response.write("<br>array is " & l & " long")
For i = LBound(array) to UBound(array)
response.write("<br>" & array(i))
Next
End If
以上测试代码return向浏览器发送以下内容:
This,Is,A,Test,String
array is -1 long
我是不是漏掉了什么?
谢谢!
对于神秘的空格,添加 TRIM() 以确保您没有以空格开头:
If fieldName = "txt_EnvironmentType" then
strTempEnvCSV = strTempEnvCSV & TRIM(fieldValue) & ","
End If
这个 运行(针对你的第二期)对我来说 - 我所做的唯一改变是使数组变量变暗并将其命名为 "array"
以外的名称
<%
dim arrMine
txtEnvironmentType = "This,Is,A,Test,String"
If txtEnvironmentType <> "" then
response.write(txtEnvironmentType)
arrMine = split(txtEnvironmentType,",")
l = ubound(arrMine)
response.write("<br>arrMine is " & l & " long")
For i = LBound(arrMine) to UBound(arrMine)
response.write("<br>" & arrMine(i))
Next
End If
%>
这是一个非常特殊的问题。我安装了 2012 Server 运行 IIS 8,支持经典 ASP。我正在从表单构建一个逗号分隔的字符串。然后我从 table 中检索这个字符串并想用逗号分隔。
首先,当我构建字符串并将其提交给数据库(SQL Express 2014)时,即使没有 space,也会在每个逗号后添加一个 space在代码中。
其次,当我 return 字符串并尝试在逗号上拆分时,它什么也没做; ubound 方法 returns -1...出于测试目的,我手动构建了一个数组,它具有相同的行为。
构建 csv 字符串的代码:
If fieldName = "txt_EnvironmentType" then
strTempEnvCSV = strTempEnvCSV & fieldValue & ","
End If
拆分测试代码:
txtEnvironmentType = "This,Is,A,Test,String"
If txtEnvironmentType <> "" then
response.write(txtEnvironmentType)
array = split(txtEnvironmentType,",")
l = ubound(array)
response.write("<br>array is " & l & " long")
For i = LBound(array) to UBound(array)
response.write("<br>" & array(i))
Next
End If
以上测试代码return向浏览器发送以下内容:
This,Is,A,Test,String
array is -1 long
我是不是漏掉了什么?
谢谢!
对于神秘的空格,添加 TRIM() 以确保您没有以空格开头:
If fieldName = "txt_EnvironmentType" then
strTempEnvCSV = strTempEnvCSV & TRIM(fieldValue) & ","
End If
这个 运行(针对你的第二期)对我来说 - 我所做的唯一改变是使数组变量变暗并将其命名为 "array"
以外的名称<%
dim arrMine
txtEnvironmentType = "This,Is,A,Test,String"
If txtEnvironmentType <> "" then
response.write(txtEnvironmentType)
arrMine = split(txtEnvironmentType,",")
l = ubound(arrMine)
response.write("<br>arrMine is " & l & " long")
For i = LBound(arrMine) to UBound(arrMine)
response.write("<br>" & arrMine(i))
Next
End If
%>