display an image stored in a ole field

Results 1 to 2 of 2

Thread: display an image stored in a ole field

  1. #1
    Pierre Morissette Guest

    Default display an image stored in a ole field

    What is wrong with my code?<BR>I want to display a gif image stored in a ole field in an acces db.<BR><BR>This is the code I use and the image is not displayed on the page.<BR><BR>&#060;%@ language=VBScript %&#062;<BR>&#060;% Response.ContentType = "image/gif" %&#062;<BR>&#060;% Response.Buffer = True %&#062;<BR><BR>&#060;!-- #include file="Adovbs.inc" --&#062;<BR>&#060;!--#include file="connect.asp"--&#062;<BR>&#060;% pw = request.querystring("password") %&#062;<BR>&#060;% gblwhich= request.querystring("id")<BR>latable = request.querystring("latable")<BR>nbrub = request.querystring("nombrerub")<BR>SQL = "select * from "<BR>sql = sql & latable<BR>SQL = SQL & " WHERE ID=" & gblwhich <BR>Set RS = Conntemp.Execute(SQL)<BR> set rstemp=conntemp.execute(sql)<BR>howmanyfields=rste mp.fields.count -1<BR> for i= 0 to howmanyfields <BR>if rstemp.fields(i).type = 205 then <BR>response.Clear <BR> Response.BinaryWrite rstemp.fields(i).value<BR>else <BR>end if <BR>next<BR>rstemp.close<BR>set rstemp=nothing<BR>conntemp.close<BR>set conntemp=nothing<BR>%&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: display an image stored in a ole field

    What is the error, if any?<BR><BR>Also, why do you open 2 recordsets with the same query? You should also check for rstemp.EOF() before accessing any of the fields or you will get an error. <BR><BR>More questions I would have:<BR>- Is conntemp a ADODB.Connection that has been Open()ed?<BR>- What is the value of request.querystring("latable")? That&#039s rather important. Maybe it&#039s empty..<BR>- What is the datatype of the gif fields? Probably they are adLongBinary (205) but could be adVarBinary (204). You could use these constant if you wish, since you are including adovbs.inc.<BR>- Does the image field contain a gif or just its filename as text?<BR>- If you response.Write the sql statement what is it? Does it return the recordset you expect if you run it directly in your database instead of in an asp page? Is it well-formed? Does it give errors, etc? It will save you time to debug that outside of the asp environment.<BR><BR>hope it helps<BR><BR>

Posting Permissions

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