I have Classic ASP application, within a class, I extract the record by a simple select. In the view page (index.asp) I want to show the record, so I instantiated a class like:
Set user_profile = New user
Now I want manipulate and show records as I want:
<li><%=user.name%></li>
<li><%=user.surname%></li>
.......
In this case, logically, I have not a loop but I see only 1 record for instance. Is it possible to add a for each in the view page like a real MVC system in ASP classic?
to clarify, i have this situation:
class category_view
Public id
Public name
Private Sub Class_Initialize()
sql = " SELECT * FROM category_tbl ORDER BY category_name ASC "
Set rs_cat = Server.CreateObject("ADODB.Recordset")
rs_cat.Open sql, Conn ,1,3
if rs_cat.RecordCount > 0 then
rs_rows = rs_cat.GetRows()
rs_catLoop = ubound(rs_rows,2)
For iCounter = 0 to rs_catLoop
id = rs_rows(0,iCounter)
name = rs_rows(1,iCounter)
Next
End if
rs_cat.close
End Sub
Private Sub Class_Terminate()
End Sub
end class
View page:
Set category = New category_view
(for each here)
<%=category.name%>
I need to access and reuse recordset information everywhere