具有旧式Classic ASP项目,需要执行以下操作。我创建了一个课程:
Class MeView
Private m_x
Public Property Get X()
X = m_x
End Property
Public Property Let X(value)
m_x = value
End Property
Private m_y
Public Property Get Y()
Y = m_y
End Property
Public Property Let Y(value)
m_y = value
End Property
结束班级
现在我定义变量:
Dim Me
Dim MeList()
Dim index : index = 0
然后,我遍历结果集并将值分配给Me类。之后,我将Me对象放入数组中。
if not rs.eof then
while not rs.EOF
Redim Preserve MeList(index)
Set Me = New MeView
Me.X = Sanitize(rs("X"))
Me.Y = Sanitize(rs("Y"))
Set MeList(index) = Me
index = index + 1
rs.Movenext
wend
end if
到目前为止,到目前为止,如果我检查MeList的UBound,它会显示正确的值。问题出现在这里:
Dim i
For i = 0 to Ubound(MeList)
Set Me = New MeView
Me = MeList(i)
Response.write Me(i).X
Next
我收到以下错误 Microsoft VBScript运行时错误'800a01a8' 所需对象:“ [未定义]”
我已经看了2天了,只是看不出问题是什么。 任何向我指出正确方向的建议,将不胜感激。