Results 1 to 9 of 9

Thread: Showing picture I have in database

  1. #1

    Thread Starter
    Hyperactive Member Radames's Avatar
    Join Date
    Feb 2001
    Location
    Tech Tropics
    Posts
    360

    Showing picture I have in database

    How do I make a picture I have in an Access database be seen in a web page?
    It is saved as an OLE object in the database. Thanks
    Top Tip: You can make friends and impress the opposite sex at geeky cocktail parties by saying "DB" instead of database. - Karl Moore

  2. #2
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    just put the path of your picture in your db!!

    and do something like(when yu retrieve your record set)

    <img src="<%=rs("picture")%>" border="0">

  3. #3

    Thread Starter
    Hyperactive Member Radames's Avatar
    Join Date
    Feb 2001
    Location
    Tech Tropics
    Posts
    360
    Wow that was simple!
    And I was here going crazy. Darn 24-hour books. grrr...

    Thanks a lot!!
    Top Tip: You can make friends and impress the opposite sex at geeky cocktail parties by saying "DB" instead of database. - Karl Moore

  4. #4

    Thread Starter
    Hyperactive Member Radames's Avatar
    Join Date
    Feb 2001
    Location
    Tech Tropics
    Posts
    360
    But unfortunately it does not work when I have something like



    While Not objRS.EOF
    Response.Write "<img src="<%=rs("picture")%>" border="0"> "
    objRS.MoveNext
    Wend


    I have a couple of them in the database! What can I do?
    Top Tip: You can make friends and impress the opposite sex at geeky cocktail parties by saying "DB" instead of database. - Karl Moore

  5. #5
    Lively Member
    Join Date
    Feb 2001
    Posts
    87
    try this buddy..


    Code:
    While Not objRS.EOF 
    Response.Write '<img src=' & rs("picture") & ' border="0"> ' 
    objRS.MoveNext 
    Wend
    MohamadHassan<equuelus@icqmail.com>

    Javascript,VBScript,ASP,LearningVBfor.NET

    ICQ:7205608

  6. #6

    Thread Starter
    Hyperactive Member Radames's Avatar
    Join Date
    Feb 2001
    Location
    Tech Tropics
    Posts
    360
    Sorry guys but none of the ways youve given me seem to work;. Perhaps what I did wrong was the way I stored the pictures in the database. (theyre jpegs by the way)

    I defined the field as an OLE object, then right clicked on it and selected insert object. Then I selected 'image' and browsed to the file. Do you know if my error is there?

    How did you guys store the picture?
    Top Tip: You can make friends and impress the opposite sex at geeky cocktail parties by saying "DB" instead of database. - Karl Moore

  7. #7

    Thread Starter
    Hyperactive Member Radames's Avatar
    Join Date
    Feb 2001
    Location
    Tech Tropics
    Posts
    360
    Is it better if its a gif?
    Top Tip: You can make friends and impress the opposite sex at geeky cocktail parties by saying "DB" instead of database. - Karl Moore

  8. #8
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    According to Wrox - Profesional ASP 2.0 an image can be displayed in an asp page with the following code.

    <%@ Language=VBScript %>
    <% 'Clear out the existing HTTP header information
    Response.Expires=0
    Response.buffer=true
    Response.Clear

    'Change the HTTP header to reflect that an image is being passsed
    Response.ContentType="image/gif"
    set cn=Server.CreateObject("ADODB.Connection")
    cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=pubs;Data Source=isd03"
    set objRs = cn.Execute("select logo from pub_info where pub_id = '0877'")

    Response.BinaryWrite(objRs("logo"))
    Response.End
    %>

    It works for me intermitently, may you would have more luck or someone else can help with soem refinements.

    Sorry I can't help you specifically...


    Things I do when I am bored: DotNetable

  9. #9

    Thread Starter
    Hyperactive Member Radames's Avatar
    Join Date
    Feb 2001
    Location
    Tech Tropics
    Posts
    360
    I cannot use
    Response.ContentType="image/gif"

    because I have numers, text and pictures in the recordset. I want to display the text and the picture that matches the query.
    Top Tip: You can make friends and impress the opposite sex at geeky cocktail parties by saying "DB" instead of database. - Karl Moore

Posting Permissions

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



Click Here to Expand Forum to Full Width