Yes, you can do that if you want to. Something like:
<%
Dim objMainItem
Set objMainItem = New ItemContent
objMainItem.item_id = 1
objMainItem.Open()
Response.write objMainItem.Header
Set objMainItem = Nothing
Class ItemContent
Private iItemID, sHeader
Public Sub Open()
If iItemID <> "" Then
Dim oADO, rs
Set oADO = Server.CreateObject("ADODB.Connection")
oADO.Open "Your connection string here"
Set rs = oADO.Execute("SELECT [Header] FROM [Table1] WHERE [item_id]=" &
iItemID)
If Not rs.EOF Then
sHeader = rs.Fields.Item(0).Value
End If
rs.Close : Set rs = Nothing
oADO.Close : Set oADO = Nothing
End If
End Sub
Public Property Let item_id(id)
iItemID = id
End Property
Public Property Get Header()
Header = sHeader
End Property
End Class
%>
You could add other private vars and "public property gets" if you have more
than one column to retreive.
Ray at work
"Boardrider" <bo***********@hotmail.com> wrote in message
news:26**************************@posting.google.c om...
Hi,
Assuming I create an object as below
<%
Dim objMainItem
Set objMainItem = New ItemContent
objMainItem.item_id = 1
objMainItem.Open()
%
and the class ItemContent creates a recordset based on the item_id
passed in.
Each item record contains the fields (header,label,content). I would
like to reference the fields in the following format
<%= objMainItem.header %
Is this possible?
Many thanks,
s/.