Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2003
    Location
    USA
    Posts
    18

    Question Unanswered: View images stored in Access

    Hi
    I am trying to view the images stored in my Access DB, as an OLE Object, using ASP
    I tried
    Response.binarywrite objDB("Images")
    but it didnt show the image stored in the db
    Any clues?
    Thanks

  2. #2
    Join Date
    Apr 2003
    Location
    Evansville, Indiana
    Posts
    76

    Lightbulb

    You are very close. You have to use the .ContentType property in conjunction with the BinaryWrite method when outputting images...
    Code:
    ' set the ContentType property
    Response.ContentType = "image/gif"
    
    ' send the binary data to the webbrowser
    Response.BinaryWrite (rs("NameOfImageField"))
    HTH!

    Kael

  3. #3
    Join Date
    Feb 2003
    Location
    USA
    Posts
    18
    Thanks for replying
    Heres my code

    <%@ Language=VBScript %>
    <%Response.ContentType = "image/gif"%>
    <HTML>
    <BODY>
    <%
    set conn=Server.CreateObject("ADODB.Connection")
    Set objRS = Server.CreateObject("ADODB.Recordset")
    conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("test.mdb")
    objRS.Open "select * from test",conn
    Response.binarywrite objRS("pict")
    objRS.Close
    set objRS=nothing
    conn.Close
    set conn=nothing
    %>
    </BODY>
    </HTML>
    This time it showed some weird characters as output.
    Any suggestions?
    Thanks

  4. #4
    Join Date
    Apr 2003
    Location
    uk
    Posts
    3

    Exclamation

    Hi,

    I suspect that you are confusing a few things. Does your database named "test" has a table named "test" in it? Server.Mappath should refer to a directory identified in your web server.

    If the above is satisfied than just to be sure, try to display another field (text preferably) from the fetched table.

  5. #5
    Join Date
    Feb 2003
    Location
    USA
    Posts
    18
    I realise I sound confusing but I do have a test.mdb with a "test" table. And I can display another field from the table which is text. Could it be the datatype in the db thats causing the problem?
    I have pict column with an "OLE Object" datatype.
    To add a picture to the column
    I select Insert--> Object
    That shows a pop up.
    Select option "Create From File option" and browse to select a gif file.
    Am I right? Is there any other way of adding pictures to the db?

  6. #6
    Join Date
    Aug 2002
    Posts
    3

    Post Same type of problem.

    I have gotten this to work and to display the images if they are posted to the database as a BLOB.

    I have gotten this far by using ASPUpload.

    I do thought have a very large database of images that have been drag and droped into an MS Access form and was told that they are stored in the database as OLE Objects.

    I am trying to get an ASP Page to allow me to display and download these from the database.

  7. #7
    Join Date
    Feb 2003
    Location
    USA
    Posts
    18

    Re: Same type of problem.

    I ended up doing it this way
    http://www.sagas.net/asp/show.aspx?abcd=93
    works fine for me.

    Originally posted by oddessy
    I have gotten this to work and to display the images if they are posted to the database as a BLOB.

    I have gotten this far by using ASPUpload.

    I do thought have a very large database of images that have been drag and droped into an MS Access form and was told that they are stored in the database as OLE Objects.

    I am trying to get an ASP Page to allow me to display and download these from the database.

  8. #8
    Join Date
    Aug 2002
    Posts
    3

    Drag and drop function

    Thanks farzinm

    I am currently looking at ASPUpload and XUpload for a drag and drop upload option. If anyone has any other options would love to hear and check them out.

    I also have the problem of all the images that are currently in MS Access 2000 that were drag and droped as OLE Objects. Over 50,000 documents. I need to convert them to BLOB's and keep all of the data that is in the same record with them so that I can link and display them on the web.

Posting Permissions

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