473,394 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Classes and recordsets

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/.
Jul 19 '05 #1
1 1245
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/.

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Marco Alting | last post by:
Is it possible to INNER JOIN two recordsets in ASP? I don't mean the normal JOIN you would use with two tables, but actually join the recordsets in ASP?
8
by: CJM | last post by:
For the majority of my work, I just use plain ASP. On the rare occasion that I am doing something intensive that does require user interaction I might create a COM component (ie where performance...
6
by: Steve Jorgensen | last post by:
I keep having problems in which ADO disconnected recordset work under some circumstances, but lose all their data at other times, having no rows or fields, though the recordset object still exists....
2
by: Pieter Linden | last post by:
The answer to this one is probably "test it yourself and find out!", but I'll ask anyway. Pursuant to my previous question - sending separate recordsets to Word using the CreateTableFromRecordset...
1
by: lakshmi | last post by:
Hi all, I recently rewrote a data intensive C++ program in C#. The C++ program was traversing 3 recordsets that were all open at the same time. I replaced those 3 recordsets with 3 .NET data...
16
by: Randy Harris | last post by:
I was inspired by the recent discussion of returning multiple recordsets to ADO from a stored procedure. (Amazed is probably more accurate). I asked about how to accomplish same with Oracle and...
24
by: Donald Grove | last post by:
I want to populate an array with values from an ado recordset (multiple rows) I use the absolute position of the cursor in the recordset to define the row of my array to be populated. I have a...
4
by: mrmagoo | last post by:
I'm building a vb.net Forms project that is getting data from a SQL Server database. One of the main goals of the project is to be really responsive to events, such as textbox change events. I...
4
by: rdemyan via AccessMonster.com | last post by:
Can someone help me with creating code that will look for DAO recordsets in modules and then check to see if the recordset is also closed in the module. All of my recordsets are of the form rs*...
11
by: BeckR | last post by:
Hello - Thanks for reading my post. I am a newbie when it comes to VBA programming, but have managed to do what I need to do, until now. I have an Access 2000 database (running WinXP Pro...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.