Just wanted to show the code that was successful in allowing me to create a dynamic table that would take items from my recordset and display them '3 per row'.
I hope this example helps others, as I was helped by reading other's posting to this forum.
Note that this code is more from JimEkleberry's efforts than mine.
Thanks again to Jim and 'lobstah' for their replies to my post.
The resulting code:
<%
dim conn, query, data
Set conn = Server.CreateObject("ADODB.Connection"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};_
DBQ=" & Server.MapPath("\kimmyart\db\kimmy.mdb"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
'Create the SQL query and the record set
query = "SELECT * FROM tblSculptures"
Set data = Server.CreateObject( "ADODB.Recordset" )
Call data.Open ( query, conn )
%>
<%
dim counter, limit
'set starting point for each row (first item(s))
counter = 1
'set limit of item(s) per row
limit = 3
if not data.EOF then
response.write "<table>"
do while not data.EOF
if counter = 1 then
response.write "<tr>"
end if
'Display the item(s) I want from recordset as well as
'link them to a "larger image" page
response.write "<td valign=top align=center>" &_
"<a href=" & chr(34) & "lgsculpture.asp_
productid=" & data("productID"
& chr(34) &_
">" & "<img border=0 src=" & data("smallImages"
_
"></a>" & "<br><font color=black size=2>" &_
data("productName"
& "<br>" &_
data("productDescription"
& "<br>" & "$" &_
data("unitPrice"
& "</font></td>"
counter = counter + 1
'close the row if limit is met
if counter > limit then
response.write "</tr>"
'this next code was added to display a dividing
'bar between each row
response.write "<tr>" & "<td align=center_
colspan=4>" & "<hr color=black width=70%_
noshade>" & "</td>" & "</tr>"
counter = 1
end if
'when limit is met move to and create next row
data.movenext
loop
'this part will close the table when all items
'from your recordset(requested) are displayed
if counter > 1 and counter <= limit then
do while counter <= limit
response.write "<td></td>"
counter = counter + 1
loop
response.write "</tr>"
end if
response.write "</table>"
end if
%>
I eliminated some of the code that JimEkleberry gave me (see earlier post) because (most likely) I didn't understand it's purpose and things worked without it. I will probably find out later (regretfully) why I should have kept it in the code. Oh well, live and learn.
Thanks again.
I hope this example helps others, as I was helped by reading other's posting to this forum.
Note that this code is more from JimEkleberry's efforts than mine.
Thanks again to Jim and 'lobstah' for their replies to my post.
The resulting code:
<%
dim conn, query, data
Set conn = Server.CreateObject("ADODB.Connection"
conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};_
DBQ=" & Server.MapPath("\kimmyart\db\kimmy.mdb"
'Create the SQL query and the record set
query = "SELECT * FROM tblSculptures"
Set data = Server.CreateObject( "ADODB.Recordset" )
Call data.Open ( query, conn )
%>
<%
dim counter, limit
'set starting point for each row (first item(s))
counter = 1
'set limit of item(s) per row
limit = 3
if not data.EOF then
response.write "<table>"
do while not data.EOF
if counter = 1 then
response.write "<tr>"
end if
'Display the item(s) I want from recordset as well as
'link them to a "larger image" page
response.write "<td valign=top align=center>" &_
"<a href=" & chr(34) & "lgsculpture.asp_
productid=" & data("productID"
">" & "<img border=0 src=" & data("smallImages"
"></a>" & "<br><font color=black size=2>" &_
data("productName"
data("productDescription"
data("unitPrice"
counter = counter + 1
'close the row if limit is met
if counter > limit then
response.write "</tr>"
'this next code was added to display a dividing
'bar between each row
response.write "<tr>" & "<td align=center_
colspan=4>" & "<hr color=black width=70%_
noshade>" & "</td>" & "</tr>"
counter = 1
end if
'when limit is met move to and create next row
data.movenext
loop
'this part will close the table when all items
'from your recordset(requested) are displayed
if counter > 1 and counter <= limit then
do while counter <= limit
response.write "<td></td>"
counter = counter + 1
loop
response.write "</tr>"
end if
response.write "</table>"
end if
%>
I eliminated some of the code that JimEkleberry gave me (see earlier post) because (most likely) I didn't understand it's purpose and things worked without it. I will probably find out later (regretfully) why I should have kept it in the code. Oh well, live and learn.
Thanks again.