Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

displaying a "catalog list" of items with photos stored in oracle tabl

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
US
I need an .asp page to generate a simple list of rows from an oracle 10g table that has four photos stored in four blob columns.

my select statement is something like:
select item_name, color, size, photo_front, photo_back, photo_left, photo_right from myitems

I just want to display this data in a simple "catalog like" list in a table when the user opens the .asp page.

I have managed to get blobs out of oracle before for one item at at time but it requires the user to click on each individual item. I havnt been able to modify that code so it will display all the photos when the page comes up, and i havnt found any other way that i could make work so far.

I'm sure i must be making this harder than it actually is. Can anybody point me in the right direction? I've searched all over and cant find anything that works.

thanks
 
Not pretty, but should get you on the right track. Just loop through the recordset and add rows to an html table:
Code:
response.write "<TABLE>"

rs.Open sql, Conn
Do While not rs.EOF

   response.write "<TR>" & _
      "<TD>" & rs("item_name") & _
      "<TD>" & rs("color") & _
      etc etc.

   rs.MoveNext
Loop
rs.Close
response.write "</TABLE>"
 
thanks but the blobs wont work that way. You just get a data mismatch when you try that with a blob.

The way I have done it before is something like this:
In my mainpage.asp I have
<td>
<IMG SRC="onephoto.asp?mtarget=1002" width=80 height=80></img>
</td>


onephoto.asp contains:

target = session("mtarget")
Response.ContentType = "image/*"
response.buffer = true
response.clear

Set rs = con.Execute("SELECT photo_front FROM mytable where item_id=" & mtarget)
strtmp = rs("photo_front")
Response.BinaryWrite(strtmp)

This will work, but not when its IN the recordset loop. It works fine if I have on my main page a hyperlink that the user clicks on for ONE object. But When its placed in the loop it just wont step through the item_ids of the recordset.

This will work for one item:

<% do while not rsnamelist.eof %>
<TR> <td>
<IMG SRC="oneitem.asp?mtarget=1002" width=80 height=80></img>
</TD>
<% RSNameList.MoveNext %>
<% loop %>

But, If I pass the item_id like:
<img drc="oneitem.asp>mtarget=item_id" </img>
it wont work for me that way

 
In the looping page, you establish
[tt] session("x_1002")=rs("photo_front").value 'when 1002 is the mtarget or whatever in the querystring[/tt]
Then in the oneitem.asp, pick up the querystring and use response.binarywrite of the session("x_1002") or the corrsponding one and then clear the session written out already to release the memory.
 
i think i tried something like that, but ill give it another try.

 
If you don't want to use session which involves some more variable matching that you can do wrong, you can always write the src attribute with the proper querystring and then in the oneitem.asp query again the db to write out the byte(). That takes two trips of fetching hence taking more time but with less memory footprint.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top