VBScript对象属性/方法调用?

时间:2019-01-24 17:01:24

标签: vbscript asp-classic

我正在使用VBScript调试旧版经典ASP网站。在global.asa文件中,我发现有一些代码,我无法弄清楚方法/属性的来源。想知道是否有人可以指出我的方向?

Dim ArrayIndex, AllCityIDs, AllCityNames, EmployeeIDs, EmployeeNames, oEmp

    Set oCity = Server.CreateObject("EmployeeDB.City")
    Set colCities = oCity.List

    Set oEmp = Server.CreateObject("EmployeeDB.Employee")

    Redim CityEmployeeArray (colCities.Count - 1)

    ArrayIndex = 0
    ' for each City, let's build the Employee list for that city.
    for each oItem In colCities
        AllCityIDs = AllCityIDs & oItem.Index & " || "
        AllCityNames = AllCityNames & oItem.Value & " || "

        'response.Write("oItem.Index:")
        'response.Write(oItem.Index)

        Set colCityEmployees = oEmp.EmployeesByCity (oItem.Index)

        'response.Write("colCityEmployees:")
        'response.Write(colCityEmployees.Count)

        EmployeeIDs = vbNullString
        EmployeeNames = vbNullString

        for each oCityEmp in colCityEmployees
            EmployeeIDs = EmployeeIDs & oCityEmp.Index & " || "
            EmployeeNames = EmployeeNames & oCityEmp.Value & " || "
        next

        EmployeeIDs = RemoveEndDelimiter (EmployeeIDs, " || ")
        EmployeeNames = RemoveEndDelimiter (EmployeeNames, " || ")

        CityEmployeeArray(ArrayIndex) = Array(oItem.Index, Array(EmployeeIDs, EmployeeNames))

        ArrayIndex = ArrayIndex + 1
    next

    Set oCity = Nothing

End Sub

我想知道这一行

Set colCityEmployees = oEmp.EmployeesByCity (oItem.Index)

EmployeesByCity属性/方法从何而来?以及如何通过oItem.Index参数获取colCityEmployees的值?

在本地IIS上运行页面时,我也收到一行错误

for each oCityEmp in colCityEmployees

Microsoft VBScript运行时错误'800a01c3'

对象不是集合

/LM/W3SVC/5/ROOT/PHONELISTADMIN/global.asa,第80行

任何建议将不胜感激。

谢谢。

0 个答案:

没有答案