How to display ALL BLOB images in a table?

Results 1 to 3 of 3

Thread: How to display ALL BLOB images in a table?

  1. #1
    Join Date
    Dec 1969

    Default How to display ALL BLOB images in a table?

    &#060;%@ LANGUAGE="VBSCRIPT" %&#062;<BR>&#060;%<BR>&#039; Clear out the existing HTTP header information<BR>Response.Expires = 0<BR>Response.Buffer = TRUE<BR>Response.Clear<BR> <BR>&#039; Change the HTTP header to reflect that an image is being passed.<BR>Response.ContentType = "image/gif"<BR> <BR>Set cn = Server.CreateObject("ADODB.Connection")<BR>&#039; The following open line assumes you have set up a System DataSource<BR>&#039; by the name of myDSN.<BR>cn.Open "DSN=myDSN;UID=sa;PWD=;DATABASE=pubs"<BR>Set rs = cn.Execute("SELECT logo FROM pub_info WHERE pub_id=&#039;0736&#039;")<BR>Response.BinaryWrite rs("logo")<BR>Response.End<BR>%&#062;<BR><BR>The above code shown on;EN-US;q173308<BR><BR>The database is from SQL Server "pubs".<BR><BR>However, if I changed the select statement to: "Select pub_id, logo,<BR>pr_info FROM pub_info" and add the following codes to display ALL images,<BR>the above codes then do not work!<BR><BR>Do While Not rs.EOF<BR>......<BR>Loop<BR><BR>Question to you: How to display ALL BLOB images in a table? What would be the most effective way to do it if I have 5000+ staff photos, and need to display each of them to a table?<BR><BR>Your response is appreciated.<BR>

  2. #2
    Join Date
    Dec 1969

    Default Put logo at the end of the..

    ... SELECT list and then give it a try.<BR><BR>-Doug

  3. #3
    Join Date
    Dec 1969

    Default hopefully this helps

    if you are writing out the id and blob within one page it will not work since you are calling a response.write and a response.binarywrite within the same page.<BR><BR>the only way I have found this to work is to do the following.<BR><BR>1.use looping to output table, employee name, id, etc<BR>2. within looping do a response.write("&#060;img src=&#039;image.asp?id=" & yourRs.fields("id") & "&#039;&#062;")<BR>3. note the &#060;img&#062; tag is referencing an .asp page, not an image.<BR>4. write the image.asp page to do a binary write based on the id passed in the querystring (create recordset based on id passed)<BR>5. code clean up<BR><BR>I use this method all the time. It works on the newer broswers but I think fails on some ie/netscape 3x browsers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts