Potrzebuję użyć struktury klasycznej w klasycznym asp. Napisałem następujące trzy klasy.Struktura klasy w klasycznym asp
Category.asp
<%
Class Category
Private NameVar
Public Property Get Name()
Name = NameVar
End Property
Public Property Let Name(nameParam)
NameVar = nameParam
End Property
End Class
%>
Item.asp
<%
Class Item
Private NameVar
Private CategoryVar
Public Property Get Name()
Name = NameVar
End Property
Public Property Let Name(nameParam)
NameVar = nameParam
End Property
Public Property Get Category()
category = categoryVar
End Property
Public Property Let Category(categoryParam)
CategoryVar = categoryParam
End Property
End Class
%>
Test.asp
<%
Dim CategoryVar
Set CategoryVar = New Category
CategoryVar.Name = "Weight"
Dim ItemVar
Set ItemVar = New Item
ItemVar.Name = "kg"
ItemVar.Category = CategoryVar
%>
<html>
<head>
<title>UoM Componet Testing</title>
</head>
<body>
<%= ItemVar.Name %><br/>
</body>
</html>
Kiedy uruchomić ten kod, ja znalazłem jakiś problem. Błąd jest:
Microsoft VBScript Runtime (0x800A01B6) Obiekt nie obsługuje tej właściwości lub metody.? CategoryVar '”
Jak można wyjaśnić to proszę mi pomóc
Próbowałaś 'Ustaw ItemVar.Category = CategoryVar'? –
Powtórzyłem twój błąd, to dziwne! – Rafael